Skip to content

Commit

Permalink
test: simplify assertion in http2 tests
Browse files Browse the repository at this point in the history
In test-http2-timeout-large-write.js and
test-http2-timeout-large-write-file.js:

Use assert.ok() on a boolean that the test itself creates and sets,
rather than assert.strictEqual(). This allows us to use a static message
without running afoul of the upcoming "do not use string literals with
assert.strictEqual()" lint rule.

Backport-PR-URL: #22888
PR-URL: #22849
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
Trott authored and MylesBorins committed Sep 25, 2018
1 parent f2158f3 commit e9416d4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion test/sequential/test-http2-timeout-large-write-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ server.on('stream', common.mustCall((stream) => {
}));
server.setTimeout(serverTimeout);
server.on('timeout', () => {
assert.strictEqual(didReceiveData, false, 'Should not timeout');
assert.ok(!didReceiveData, 'Should not timeout');
});

server.listen(0, common.mustCall(() => {
Expand Down
4 changes: 2 additions & 2 deletions test/sequential/test-http2-timeout-large-write.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ server.on('stream', common.mustCall((stream) => {
stream.write(content);
stream.setTimeout(serverTimeout);
stream.on('timeout', () => {
assert.strictEqual(didReceiveData, false, 'Should not timeout');
assert.ok(!didReceiveData, 'Should not timeout');
});
stream.end();
}));
server.setTimeout(serverTimeout);
server.on('timeout', () => {
assert.strictEqual(didReceiveData, false, 'Should not timeout');
assert.ok(!didReceiveData, 'Should not timeout');
});

server.listen(0, common.mustCall(() => {
Expand Down

0 comments on commit e9416d4

Please sign in to comment.