From 2a22744a37d097abd2330a147c64587a49298287 Mon Sep 17 00:00:00 2001 From: Brendan Kenny Date: Thu, 25 Apr 2019 12:08:32 -0700 Subject: [PATCH] modify test to allow default array for stackPacks --- lighthouse-core/test/report/proto-test.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lighthouse-core/test/report/proto-test.js b/lighthouse-core/test/report/proto-test.js index a90811ee78f1..8282ffbf3dd3 100644 --- a/lighthouse-core/test/report/proto-test.js +++ b/lighthouse-core/test/report/proto-test.js @@ -45,12 +45,19 @@ describe('round trip JSON comparison subsets', () => { }); it('has the same top level values', () => { + // Don't test all top level properties that are objects. Object.keys(sampleJson).forEach(audit => { if (typeof sampleJson[audit] === 'object' && !Array.isArray(sampleJson[audit])) { delete sampleJson[audit]; } }); + // Properties set to their type's default value will be omitted in the roundTripJson. + // For an explicit list of properties, remove sampleJson values if set to a default. + if (Array.isArray(sampleJson.stackPacks) && sampleJson.stackPacks.length === 0) { + delete sampleJson.stackPacks; + } + expect(roundTripJson).toMatchObject(sampleJson); });