Browse Source

feat(js-checkpoint):add test for more exercise

CON-2199-TESTS-create-test-of-more-exercise
root 1 year ago
parent
commit
012be53557
  1. 19
      js/tests/more_test.js

19
js/tests/more_test.js

@ -0,0 +1,19 @@
export const tests = []
const t = (f) => tests.push(f)
// more is declared and is a function and take 1 argument
t(() => typeof more === 'function')
t(() => more.length === 1)
// more works with positive numbers
t(() => more(5) === 6)
t(() => more(more(more(5))) === 8)
// more works with negative numbers
t(() => more(-5) === -4)
t(() => more(more(more(-5))) === -2)
const rand = Math.random()
t(() => more(rand) === rand + 1)
Object.freeze(tests)
Loading…
Cancel
Save