Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions test/doctool/test-doctool-html.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,18 +115,19 @@ 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, but it should be');

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea here is to include the actual value and not only to change the message.
So it should actually be like

assert(actual.includes(scriptDomain),
           `Google Analytics script was not present in "${actual}"`);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chowdhurian could you push a commit to this branch that makes the change @BridgeAR suggested? LGTM with those changes.

} 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, but it should not be');
}
}));
}));
Expand Down