UNPKG

ds-algo-study

Version:

Just experimenting with publishing a package

35 lines (30 loc) 805 B
const assert = require("assert"); const exactly = require("../problems/12-exactly.js"); describe("exactly", function() { it("", function() { let result1 = exactly([18, 5, 32, 7, 100], 3, function(n) { return n % 2 === 0; }); assert.equal(result1, true); let result2 = exactly([18, 5, 32, 7, 100], 2, function(n) { return n % 2 === 0; }); assert.equal(result2, false); let result3 = exactly( ["follow", "the", "yellow", "brick", "road"], 1, function(str) { return str.includes("x"); } ); assert.equal(result3, false); let result4 = exactly( ["follow", "the", "yellow", "brick", "road"], 0, function(str) { return str.includes("x"); } ); assert.equal(result4, true); }); });