From ddc81a204f8ce950329f1d5f2d0f8b6cce08c472 Mon Sep 17 00:00:00 2001 From: Alisdair McDiarmid Date: Mon, 7 Feb 2022 15:04:49 -0500 Subject: [PATCH] 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. --- internal/command/show_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/command/show_test.go b/internal/command/show_test.go index 5f220e906..00a9e555a 100644 --- a/internal/command/show_test.go +++ b/internal/command/show_test.go @@ -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)) }