Commit 52b666ee authored by Alexey Orlenko's avatar Alexey Orlenko Committed by James M Snell
Browse files

test: fix broken tests in test-buffer-includes

Some of the tests for `buffer.includes()` functionality introduced in
https://github.com/nodejs/node/pull/3567 have been broken in a way that
caused them to always pass regardless of the result of the tested
method.

This behavior was caused by two reasons:

 * These tests were written as though `buffer.includes()` was supposed
   to return the same value that `buffer.indexOf()` does, i.e., used
   indices or -1 as expected return values instead of true and false.
 * `assert()` was used as the assertion function to do that instead of
   `assert.strictEqual()`.

Thus `assert()` was called with a non-zero number as the first argument
effectively causing these tests to pass.

This commit changes the tests to use `assert.ok()` and removes redundant
indices.

PR-URL: https://github.com/nodejs/node/pull/12040
Ref: https://github.com/nodejs/node/pull/3567


Reviewed-By: default avatarRich Trott <rtrott@gmail.com>
Reviewed-By: default avatarAnna Henningsen <anna@addaleax.net>
Reviewed-By: default avatarLuigi Pinca <luigipinca@gmail.com>
Reviewed-By: default avatarColin Ihrig <cjihrig@gmail.com>
Reviewed-By: default avatarYuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: default avatarSantiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: default avatarJames M Snell <jasnell@gmail.com>
parent 45df578f
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment