Skip to content

Commit

Permalink
modify test to allow default array for stackPacks
Browse files Browse the repository at this point in the history
  • Loading branch information
brendankenny committed Apr 25, 2019
1 parent 1b450ba commit 2a22744
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lighthouse-core/test/report/proto-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});

Expand Down

0 comments on commit 2a22744

Please sign in to comment.