test

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package test provides testing utilities and assertions for the agent-standards-mcp server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertGetStandardsContainsContent

func AssertGetStandardsContainsContent(
	t *testing.T,
	plainText string,
	standardName, expectedDescription, expectedContent string,
)

AssertGetStandardsContainsContent validates that get_standards result contains full content for a standard

func AssertMultipleStandardsFormat

func AssertMultipleStandardsFormat(t *testing.T, plainText string)

AssertMultipleStandardsFormat validates that multiple standards are properly separated

func AssertPlainTextInput

func AssertPlainTextInput(t *testing.T, result *mcp.CallToolResult) string

AssertPlainTextInput validates that the result contains plain text content

func AssertStandardContainsContent

func AssertStandardContainsContent(t *testing.T, plainText string, standardName, expectedContent string)

AssertStandardContainsContent validates that a standard in plain text contains expected content

func AssertStandardContainsDescription

func AssertStandardContainsDescription(t *testing.T, plainText string, standardName, expectedDescription string)

AssertStandardContainsDescription validates that a standard in plain text contains expected description

func AssertStandardListContains

func AssertStandardListContains(t *testing.T, plainText string, standardName string)

AssertStandardListContains validates that plain text contains a specific standard by name

func AssertStandardListCount

func AssertStandardListCount(t *testing.T, plainText string, expectedCount int)

AssertStandardListCount validates that plain text contains expected number of standards

func AssertToolCallError

func AssertToolCallError(t *testing.T, suite *Suite, toolName string, args map[string]any) *mcp.CallToolResult

AssertToolCallError calls a tool and verifies it returns an error

func AssertToolCallSuccess

func AssertToolCallSuccess(t *testing.T, suite *Suite, toolName string, args map[string]any) *mcp.CallToolResult

AssertToolCallSuccess calls a tool and verifies successful execution

func AssertToolsAvailable

func AssertToolsAvailable(t *testing.T, suite *Suite, expectedTools []string)

AssertToolsAvailable checks that the expected tools are available in server

func CustomStandardFiles

func CustomStandardFiles() map[string]string

CustomStandardFiles returns a custom set of standard files for specific tests

func DefaultStandardFiles

func DefaultStandardFiles() map[string]string

DefaultStandardFiles returns the default set of test standard files

func EmptyStandardFiles

func EmptyStandardFiles() map[string]string

EmptyStandardFiles returns an empty set of standard files

func NonExistentStandardFile

func NonExistentStandardFile() map[string]string

NonExistentStandardFile returns a standard file for testing non-existent standards

Types

type MCPTestServer

type MCPTestServer struct {
	Server         *server.MCP
	Config         *config.Config
	StandardLoader server.StandardLoader
}

MCPTestServer wraps the MCP server for testing

type SetupOption

type SetupOption func(*setupConfig)

SetupOption defines configuration options for test suite

func WithClientInfo

func WithClientInfo(name, version string) SetupOption

WithClientInfo configures the MCP client identification

func WithCommandTransport

func WithCommandTransport() SetupOption

WithCommandTransport configures the setup to use command transport (real subprocess)

func WithCustomStandardFiles

func WithCustomStandardFiles(files map[string]string) SetupOption

WithCustomStandardFiles configures custom standard files

type Suite

type Suite struct {
	Client        *mcp.Client
	ClientSession *mcp.ClientSession
	Server        *MCPTestServer
	// contains filtered or unexported fields
}

Suite provides a complete MCP client-server setup for integration testing

func NewTestSuite

func NewTestSuite(t *testing.T, opts ...SetupOption) *Suite

NewTestSuite creates a complete integration test environment

func (*Suite) Cleanup

func (ts *Suite) Cleanup()

Cleanup cleans up test resources

Jump to

Keyboard shortcuts

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