ds-algo-study
Version:
Just experimenting with publishing a package
31 lines (26 loc) • 733 B
JavaScript
const assert = require("assert");
const count = require("../problems/08-count.js");
describe("count", function() {
it("", function() {
let result1 = count([18, 5, 32, 7, 100], function(n) {
return n % 2 === 0;
});
assert.equal(result1, 3);
let result2 = count([17, 5, 31, 7, 100], function(n) {
return n % 2 === 0;
});
assert.equal(result2, 1);
let result3 = count(["follow", "the", "yellow", "brick", "road"], function(
str
) {
return str.includes("o");
});
assert.equal(result3, 3);
let result4 = count(["follow", "the", "yellow", "brick", "road"], function(
str
) {
return str.includes("x");
});
assert.equal(result4, 0);
});
});