{"modulePath":"github.com/Azure/eno","version":"v0.2.27","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package functiontest\n\n## Functions\n\n```go\nfunc Evaluate[T function.Inputs](t *testing.T, synth function.SynthFunc[T], scenarios ...Scenario[T])\n```\nEvaluate runs the synthesizer function with the provided scenarios and asserts on the outputs.\n\n```go\nfunc InputsMatchSynthesizerRefs(t require.TestingT, inputObject any, synthesizerPath string, mode KeyMatchMode)\n```\nInputsMatchSynthesizerRefs is ensures your synthsizers references stay in sync with the eno\\_keys to the struct you give function.SynthFunc The level of sync can be defined by the KeyMatchMode parameter\n\n## Types\n\n```go\ntype Assertion[T function.Inputs] func(t *testing.T, s *Scenario[T], outputs []client.Object)\n```\n\n```go\nfunc AssertionChain[T function.Inputs](asserts ...Assertion[T]) Assertion[T]\n```\nAssertionChain is a helper function to create an assertion that runs multiple assertions in sequence.\n\n```go\nfunc LoadSnapshots[T function.Inputs](t *testing.T, dir string) Assertion[T]\n```\nLoadSnapshots returns an assertion that will compare the outputs of a synthesizer function with the expected outputs stored in snapshot files.\n\nScenarios that do not have a corresponding snapshot file will be ignored. To generate snapshots, set the ENO\\_GEN\\_SNAPSHOTS environment variable to a non-empty value.\n\nSo, to bootstrap snapshots for a given fixture/scenario: create an empty snapshot file that matches the name of the scenario (or fixture if using LoadScenarios), and run the tests with ENO\\_GEN\\_SNAPSHOTS=true.\n\n```go\nfunc ValidateResourceMeta[T function.Inputs]() Assertion[T]\n```\nValidateResourceMeta is an Assertion that proves the outputs are valid resources from Eno's perspective e.g. contain only valid metadata like eno.azure.io/\\* annotations.\n\n```go\ntype KeyMatchMode int\n```\n\n```go\nconst (\n\tKeyMatchStrict  KeyMatchMode = iota // all eno_keys must have a corresponding ref\n\tKeyMatchRelaxed                     // eno_keys can be a subset of refs\n)\n```\n\n```go\ntype Scenario[T function.Inputs] struct {\n\tName      string\n\tInputs    T\n\tAssertion Assertion[T]\n}\n```\nScenario represents a test case for a synthesizer function.\n\n```go\nfunc LoadScenarios[T any](t *testing.T, dir string, assertion Assertion[T]) []Scenario[T]\n```\nLoadScenarios recursively loads yaml and json input fixtures from the specified directory.\n\n","path":"github.com/Azure/eno/pkg/functiontest","name":"functiontest","synopsis":"","isRedistributable":true}
