feat: add typed error message templates and stable replay snapshots
This commit is contained in:
@@ -84,12 +84,17 @@ func TestErrorCatalogDocumentAndValidation(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestErrorCatalogConsumer(t *testing.T) {
|
||||
testCatalogConsumer(t, "errors.api", "errorCatalog")
|
||||
}
|
||||
|
||||
func testCatalogConsumer(t *testing.T, apiFile, fixtureName string) {
|
||||
t.Helper()
|
||||
if os.Getenv("GO_OMNI_SCAFFOLD_INTEGRATION") == "" {
|
||||
t.Skip("consumer integration")
|
||||
}
|
||||
root := frameworkRoot(t)
|
||||
dir := filepath.Join(t.TempDir(), "consumer")
|
||||
opts := Options{API: filepath.Join(root, "examples/contracts/errors.api"), Dir: dir, Module: "example.com/errorCatalog", FrameworkDir: root}
|
||||
opts := Options{API: filepath.Join(root, "examples/contracts", apiFile), Dir: dir, Module: "example.com/errorCatalog", FrameworkDir: root}
|
||||
cli := os.Getenv("GO_OMNI_RELEASE_CLI")
|
||||
generate := func(check bool) {
|
||||
t.Helper()
|
||||
@@ -113,7 +118,7 @@ func TestErrorCatalogConsumer(t *testing.T) {
|
||||
}
|
||||
generate(false)
|
||||
|
||||
fixture := readFile(t, "testdata/errorCatalog/consumer_test.go")
|
||||
fixture := readFile(t, filepath.Join("testdata", fixtureName, "consumer_test.go"))
|
||||
writeFile(t, filepath.Join(dir, "consumer_test.go"), fixture)
|
||||
generate(false)
|
||||
generate(true)
|
||||
|
||||
Reference in New Issue
Block a user