Skip to content

Commit

Permalink
json: Disregard format version in tests
Browse files Browse the repository at this point in the history
Instead of manually updating every JSON output test fixture when we
change the format version, disregard any differences when testing.
  • Loading branch information
alisdair committed Feb 7, 2022
1 parent f5b90f8 commit ddc81a2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/command/show_test.go
Expand Up @@ -576,6 +576,9 @@ func TestShow_json_output(t *testing.T) {
}
json.Unmarshal([]byte(byteValue), &want)

// Disregard format version to reduce needless test fixture churn
want.FormatVersion = got.FormatVersion

if !cmp.Equal(got, want) {
t.Fatalf("wrong result:\n %v\n", cmp.Diff(got, want))
}
Expand Down Expand Up @@ -667,6 +670,9 @@ func TestShow_json_output_sensitive(t *testing.T) {
}
json.Unmarshal([]byte(byteValue), &want)

// Disregard format version to reduce needless test fixture churn
want.FormatVersion = got.FormatVersion

if !cmp.Equal(got, want) {
t.Fatalf("wrong result:\n %v\n", cmp.Diff(got, want))
}
Expand Down

0 comments on commit ddc81a2

Please sign in to comment.