{"modulePath":"github.com/dispatchrun/dispatch-go","version":"v0.1.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package dispatchtest\n\n## Functions\n\n```go\nfunc Call[I, O any](runner *Runner, fn *dispatch.Function[I, O], input I) (O, error)\n```\nCall calls a dispatch.Function using the specified Runner.\n\n```go\nfunc KeyPair() (signingKey, verificationKey string)\n```\nKeyPair generates a random ed25519 key pair.\n\nThe public and private key are base64 encoded, so that they can be passed directly to the various Dispatch components.\n\n```go\nfunc NewServer(handler dispatchserver.Handler) *httptest.Server\n```\nNewServer creates a new test Dispatch API server.\n\n```go\nfunc SigningKey(signingKey string) dispatchserver.EndpointClientOption\n```\nSigningKey sets the signing key to use when signing requests bound for the endpoint.\n\nThe signing key should be a base64-encoded ed25519.PrivateKey, e.g. one provided by the KeyPair helper function.\n\n## Types\n\n```go\ntype CallRecorder struct {\n\t// contains filtered or unexported fields\n}\n```\nCallRecorder is a dispatchserver.Handler that captures requests to the Dispatch API.\n\n```go\nfunc (r *CallRecorder) Assert(t *testing.T, want ...DispatchRequest)\n```\nAssert asserts that specific calls were made to the Dispatch API server, and that specified headers are present.\n\nWhen validating request headers, Assert checks that the specified headers were present, but allows extra headers on the request. That is, it's not checking for an exact match with headers.\n\n```go\nfunc (r *CallRecorder) Handle(ctx context.Context, header http.Header, calls []dispatchproto.Call) ([]dispatchproto.ID, error)\n```\n\n```go\ntype DispatchRequest struct {\n\tHeader http.Header\n\tCalls  []dispatchproto.Call\n}\n```\nDispatchRequest is a request to the Dispatch API captured by a CallRecorder.\n\n```go\ntype EndpointServer struct {\n\t// contains filtered or unexported fields\n}\n```\nEndpointServer is a server serving a Dispatch endpoint.\n\n```go\nfunc NewEndpoint(opts ...dispatch.Option) (*dispatch.Dispatch, *EndpointServer, error)\n```\nNewEndpoint creates a Dispatch endpoint, like dispatch.New.\n\nUnlike dispatch.New, it starts a test server that serves the endpoint and automatically sets the endpoint URL.\n\n```go\nfunc (e *EndpointServer) Client(opts ...dispatchserver.EndpointClientOption) (*dispatchserver.EndpointClient, error)\n```\nClient returns a client that can be used to interact with the Dispatch endpoint.\n\n```go\nfunc (e *EndpointServer) Close()\n```\nClose closes the server.\n\n```go\nfunc (e *EndpointServer) URL() string\n```\nURL is the URL of the server.\n\n```go\ntype Runner struct {\n\t// contains filtered or unexported fields\n}\n```\nRunner runs functions.\n\n```go\nfunc NewRunner(functions ...dispatch.AnyFunction) *Runner\n```\nNewRunner creates a Runner.\n\n```go\nfunc (r *Runner) Register(fn dispatch.AnyFunction)\n```\nRegister registers a function.\n\n```go\nfunc (r *Runner) RegisterPrimitive(name string, fn dispatchproto.Function)\n```\nRegisterPrimitive registers a primitive function.\n\n```go\nfunc (r Runner) RoundTrip(req dispatchproto.Request) dispatchproto.Response\n```\nRoundTrip sends a request to a function and returns its response.\n\n```go\nfunc (r *Runner) Run(req dispatchproto.Request) dispatchproto.Response\n```\nRun runs a function to completion and returns its response.\n\n","path":"github.com/dispatchrun/dispatch-go/dispatchtest","name":"dispatchtest","synopsis":"","isRedistributable":true}
