Skip to content

Commit

Permalink
revised
Browse files Browse the repository at this point in the history
  • Loading branch information
apeabody committed Nov 21, 2024
1 parent 3c0d23b commit 7a78267
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions infra/blueprint-test/pkg/golden/golden.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ func (g *GoldenFile) JSONEq(a *assert.Assertions, got gjson.Result, jsonPath str
a.Equal(gfData, gotData, fmt.Sprintf("expected %s to match fixture %s", jsonPath, gfData))
}

// JSONEqs asserts that json content in jsonPaths for got and goldenfile are the same
func (g *GoldenFile) JSONEqs(a *assert.Assertions, got gjson.Result, jsonPaths []string) {
// JSONPathEqs asserts that json content in jsonPaths for got and goldenfile are the same
func (g *GoldenFile) JSONPathEqs(a *assert.Assertions, got gjson.Result, jsonPaths []string) {
var wg sync.WaitGroup
wg.Add(len(jsonPaths))
for _, path := range jsonPaths {
Expand Down
4 changes: 3 additions & 1 deletion infra/blueprint-test/pkg/golden/golden_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,9 @@ func TestJSONEqs(t *testing.T) {
defer os.Unsetenv(gfUpdateEnvVar)
got := NewOrUpdate(t, tt.data, tt.opts...)
defer os.Remove(got.GetName())
got.JSONEqs(assert, utils.ParseJSONResult(t, tt.want), tt.eqPaths)
got.JSONPathEqs(assert, utils.ParseJSONResult(t, tt.data), tt.eqPaths)
multipathQuery := fmt.Sprintf("{%s}", strings.Join(tt.eqPaths, ","))
assert.JSONEq(tt.want, got.GetJSON().Get(multipathQuery).String())
})
}
}

0 comments on commit 7a78267

Please sign in to comment.