test

package
v0.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2026 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultExpectedRoot  = types.HexStringToHexBytesMustUnmarshal("0x0b3600e19a4f5017dea4f91f03d8aa0dd6f4c797795e7a5aa542e81b2c5a9485")
	DefaultGraphQLEvents = []TestWeightChangeEvent{
		{
			AccountID:      "0xdeb8699659be5d41a0e57e179d6cb42e00b9200c",
			PreviousWeight: "0",
			NewWeight:      "1",
		},
		{
			AccountID:      "0xa2e4d94c5923a8dd99c5792a7b0436474c54e1e1",
			PreviousWeight: "0",
			NewWeight:      "1",
		},
		{
			AccountID:      "0xb1f05b11ba3d892edd00f2e7689779e2b8841827",
			PreviousWeight: "0",
			NewWeight:      "1",
		},
		{
			AccountID:      "0x74d8967e812de34702ecd3d453a44bf37440b10b",
			PreviousWeight: "0",
			NewWeight:      "1",
		},
		{
			AccountID:      "0xf3b06b503652a5e075d423f97056dfde0c4b066f",
			PreviousWeight: "0",
			NewWeight:      "1",
		},
		{
			AccountID:      "0x74d8967e812de34702ecd3d453a44bf37440b10b",
			PreviousWeight: "1",
			NewWeight:      "0",
		},
		{
			AccountID:      "0xdeb8699659be5d41a0e57e179d6cb42e00b9200c",
			PreviousWeight: "1",
			NewWeight:      "0",
		},
		{
			AccountID:      "0xb1f05b11ba3d892edd00f2e7689779e2b8841827",
			PreviousWeight: "1",
			NewWeight:      "2",
		},
		{
			AccountID:      "0x2aed14fe7bd056212cd0ed91b57a8ec5a5e33624",
			PreviousWeight: "0",
			NewWeight:      "1",
		},
		{
			AccountID:      "0xb1f05b11ba3d892edd00f2e7689779e2b8841827",
			PreviousWeight: "2",
			NewWeight:      "1",
		},
		{
			AccountID:      "0xdeb8699659be5d41a0e57e179d6cb42e00b9200c",
			PreviousWeight: "0",
			NewWeight:      "1",
		},
		{
			AccountID:      "0xea96b32c78afbd1b01c3346f2c42cc2d89655b8d",
			PreviousWeight: "0",
			NewWeight:      "1",
		},
	}
)

Functions

func NewCensus3MerkleTreeForTest

func NewCensus3MerkleTreeForTest(ctx context.Context, origin types.CensusOrigin, votes []state.Vote, c3url string) (types.HexBytes, string, error)

Types

type TestGraphQLServer

type TestGraphQLServer struct {
	// contains filtered or unexported fields
}

TestGraphQLServer is a minimal HTTP-only GraphQL test server.

func NewTestGraphQLServer

func NewTestGraphQLServer(ctx context.Context) *TestGraphQLServer

NewTestGraphQLServer creates a new server controller.

func (*TestGraphQLServer) GraphQLEndpoint

func (s *TestGraphQLServer) GraphQLEndpoint() (string, error)

GraphQLEndpoint returns the endpoint with "graphql://" scheme.

func (*TestGraphQLServer) HTTPEndpoint

func (s *TestGraphQLServer) HTTPEndpoint() (string, error)

HTTPEndpoint returns the GraphQL HTTP endpoint.

func (*TestGraphQLServer) SetEvents

func (s *TestGraphQLServer) SetEvents(events []TestWeightChangeEvent)

SetEvents replaces the fixture dataset.

func (*TestGraphQLServer) Start

func (s *TestGraphQLServer) Start()

Start starts the HTTP server. The GraphQL endpoint is the server base URL.

func (*TestGraphQLServer) Stop

func (s *TestGraphQLServer) Stop()

Stop shuts down the server.

type TestWeightChangeEvent

type TestWeightChangeEvent struct {
	AccountID      string
	PreviousWeight string
	NewWeight      string
}

TestWeightChangeEvent is the dataset you pass to the server. Ordering rule: slice index defines ordering.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL