test: replace internal API test with public API test
The internal freelist hasItems()
test use the internal API directly.
This commit changes them to use the API as it is exposed publicly. It
tests the same code paths, but does it without needing
--expose-internals
.
Refs: https://github.com/nodejs/node/pull/27588#pullrequestreview-234284081
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
commit message follows commit guidelines