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 thatbuffer.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 ofassert.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 assert.ifError()
and removes redundant indices.
Refs: https://github.com/nodejs/node/pull/3567
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
commit message follows commit guidelines
Affected core subsystem(s)
test