fix syft-json test to use pretty json for snapshot testing (#2441)

without this fix, capturing fixtures will result in hard-to-read
failures in testing.

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
This commit is contained in:
Alex Goodman 2023-12-15 17:23:21 -05:00 committed by GitHub
parent 17c605822e
commit f4dd36ca9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -297,10 +297,15 @@ func TestEncodeFullJSONDocument(t *testing.T) {
},
}
cfg := DefaultEncoderConfig()
cfg.Pretty = true
enc, err := NewFormatEncoderWithConfig(cfg)
require.NoError(t, err)
testutil.AssertEncoderAgainstGoldenSnapshot(t,
testutil.EncoderSnapshotTestConfig{
Subject: s,
Format: NewFormatEncoder(),
Format: enc,
UpdateSnapshot: *updateSnapshot,
PersistRedactionsInSnapshot: true,
IsJSON: true,