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:
parent
f5b90f84a8
commit
ddc81a204f
|
@ -576,6 +576,9 @@ func TestShow_json_output(t *testing.T) {
|
||||||
}
|
}
|
||||||
json.Unmarshal([]byte(byteValue), &want)
|
json.Unmarshal([]byte(byteValue), &want)
|
||||||
|
|
||||||
|
// Disregard format version to reduce needless test fixture churn
|
||||||
|
want.FormatVersion = got.FormatVersion
|
||||||
|
|
||||||
if !cmp.Equal(got, want) {
|
if !cmp.Equal(got, want) {
|
||||||
t.Fatalf("wrong result:\n %v\n", cmp.Diff(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)
|
json.Unmarshal([]byte(byteValue), &want)
|
||||||
|
|
||||||
|
// Disregard format version to reduce needless test fixture churn
|
||||||
|
want.FormatVersion = got.FormatVersion
|
||||||
|
|
||||||
if !cmp.Equal(got, want) {
|
if !cmp.Equal(got, want) {
|
||||||
t.Fatalf("wrong result:\n %v\n", cmp.Diff(got, want))
|
t.Fatalf("wrong result:\n %v\n", cmp.Diff(got, want))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue