Skip to content

Commit

Permalink
test: include expected result in error messages
Browse files Browse the repository at this point in the history
PR-URL: #16039
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
  • Loading branch information
keywordnew authored and MylesBorins committed Oct 25, 2017
1 parent 342ac9f commit ab7f43a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions test/doctool/test-doctool-html.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,18 +103,20 @@ testData.forEach((item) => {
assert.ifError(err);

const actual = output.replace(spaces, '');
const scriptDomain = 'google-analytics.com';
// Assert that the input stripped of all whitespace contains the
// expected list
assert(actual.includes(expected));

// Testing the insertion of Google Analytics script when
// an analytics id is provided. Should not be present by default
if (includeAnalytics) {
assert(actual.includes('google-analytics.com'),
'Google Analytics script was not present');
assert(actual.includes(scriptDomain),
`Google Analytics script was not present in "${actual}"`);
} else {
assert.strictEqual(actual.includes('google-analytics.com'), false,
'Google Analytics script was present');
assert.strictEqual(actual.includes(scriptDomain), false,
'Google Analytics script was present in ' +
`"${actual}"`);
}
}));
}));
Expand Down

0 comments on commit ab7f43a

Please sign in to comment.