From 98553ed33389e2383eab007ad5408fd6ea16eda0 Mon Sep 17 00:00:00 2001 From: Christophe Fergeau Date: Mon, 21 Aug 2023 14:07:42 +0200 Subject: [PATCH] config: Use assert.JSONEq in JSON test When comparing strings with JSON content, assert.JSONEq is better than assert.Equal as it will give better output when the 2 strings don't match, and it tests for equivalence, not strict equality. This means changes in field order is not a failure for example. --- pkg/config/json_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/config/json_test.go b/pkg/config/json_test.go index 0c2184f3..64ac0864 100644 --- a/pkg/config/json_test.go +++ b/pkg/config/json_test.go @@ -165,7 +165,7 @@ func testJSON(t *testing.T, test *jsonTest) { vm := test.newVM(t) data, err := json.Marshal(vm) require.NoError(t, err) - require.Equal(t, test.expectedJSON, string(data)) + require.JSONEq(t, test.expectedJSON, string(data)) var unmarshalledVM VirtualMachine err = json.Unmarshal([]byte(test.expectedJSON), &unmarshalledVM)