json: Disregard format version in tests

Instead of manually updating every JSON output test fixture when we
change the format version, disregard any differences when testing.
This commit is contained in:
Alisdair McDiarmid 2022-02-07 15:04:49 -05:00
parent f5b90f84a8
commit ddc81a204f
1 changed files with 6 additions and 0 deletions

View File

@ -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))
}
@ -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))
}