testutils

package
v0.0.0-...-44ff49d Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SampleData = struct {
	UserID         string
	ContractID     string
	JobPostingID   string
	ProposalID     string
	MilestoneID    string
	OrganizationID string
	TeamID         string
	RoomID         string
}{
	UserID:         "123456789",
	ContractID:     "987654321",
	JobPostingID:   "456789123",
	ProposalID:     "789123456",
	MilestoneID:    "321654987",
	OrganizationID: "org_123456",
	TeamID:         "team_789",
	RoomID:         "room_456",
}

SampleData provides sample data for testing various API responses

Functions

func AssertJSONEqual

func AssertJSONEqual(t *testing.T, expected, actual string)

AssertJSONEqual asserts that two JSON strings are equal

func MockContractResponse

func MockContractResponse() map[string]interface{}

MockContractResponse creates a mock contract response

func MockGraphQLResponse

func MockGraphQLResponse(data interface{}, errors []interface{}) map[string]interface{}

MockGraphQLResponse creates a mock GraphQL response

func MockHTTPResponse

func MockHTTPResponse(statusCode int, body interface{}) *http.Response

MockHTTPResponse creates a mock HTTP response with the given status code and body

func MockJobPostingResponse

func MockJobPostingResponse() map[string]interface{}

MockJobPostingResponse creates a mock job posting response

func MockOAuth2Token

func MockOAuth2Token(accessToken string, expiresIn int) map[string]interface{}

MockOAuth2Token creates a mock OAuth2 token response

func MockProposalResponse

func MockProposalResponse() map[string]interface{}

MockProposalResponse creates a mock proposal response

func MockTime

func MockTime() time.Time

MockTime provides a consistent time for testing

func MockUserResponse

func MockUserResponse() map[string]interface{}

MockUserResponse creates a mock user response

Types

type GraphQLError

type GraphQLError struct {
	Message    string                 `json:"message"`
	Extensions map[string]interface{} `json:"extensions,omitempty"`
	Path       []interface{}          `json:"path,omitempty"`
	Locations  []map[string]int       `json:"locations,omitempty"`
}

GraphQLError represents a GraphQL error

func CreateGraphQLError

func CreateGraphQLError(message string, code string) GraphQLError

CreateGraphQLError creates a GraphQL error for testing

type TestServer

type TestServer struct {
	*http.ServeMux
	// contains filtered or unexported fields
}

CreateTestServer creates a test HTTP server with custom handlers

func NewTestServer

func NewTestServer() *TestServer

func (*TestServer) Start

func (ts *TestServer) Start(address string)

func (*TestServer) Stop

func (ts *TestServer) Stop()

Jump to

Keyboard shortcuts

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