(t *testing.T)
| 73 | } |
| 74 | |
| 75 | func TestStructuredOutputGoldenSchemaAudit(t *testing.T) { |
| 76 | contract := loadJSONGoldenContract(t) |
| 77 | |
| 78 | assertStringSliceMapEqual(t, "schema definitions", contract.Definitions, jsonContractDefinitions()) |
| 79 | |
| 80 | contractCommands := jsonContractCommandPathsWithVersion() |
| 81 | contractSet := make(map[string]bool, len(contractCommands)) |
| 82 | for _, command := range contractCommands { |
| 83 | contractSet[command] = true |
| 84 | } |
| 85 | |
| 86 | want := jsonCommandSchemas() |
| 87 | for _, command := range contractCommands { |
| 88 | gotSchema, ok := contract.Commands[command] |
| 89 | if !ok { |
| 90 | t.Errorf("JSON contract command %q has no golden schema", command) |
| 91 | continue |
| 92 | } |
| 93 | wantSchema, ok := want[command] |
| 94 | if !ok { |
| 95 | t.Errorf("JSON contract command %q has no code-derived schema", command) |
| 96 | continue |
| 97 | } |
| 98 | assertGoldenCommandSchemaEqual(t, command, gotSchema, wantSchema) |
| 99 | assertGoldenCommandSchemaReferences(t, command, gotSchema, contract.Definitions) |
| 100 | assertGoldenCommandStatuses(t, command, gotSchema) |
| 101 | } |
| 102 | for command, schema := range contract.Commands { |
| 103 | if !contractSet[command] { |
| 104 | t.Errorf("golden schema includes non-contract command %q", command) |
| 105 | } |
| 106 | assertGoldenCommandSchemaReferences(t, command, schema, contract.Definitions) |
| 107 | assertGoldenCommandStatuses(t, command, schema) |
| 108 | } |
| 109 | for command := range want { |
| 110 | if !contractSet[command] { |
| 111 | t.Errorf("code-derived schema includes non-contract command %q", command) |
| 112 | } |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | func TestStructuredOutputGoldenSuccessOutputAudit(t *testing.T) { |
| 117 | fixtures := loadJSONGoldenSuccessOutputs(t) |
nothing calls this directly
no test coverage detected