Skip to content

Instantly share code, notes, and snippets.

@HonzaMac
Created April 19, 2022 19:53
Show Gist options
  • Save HonzaMac/02f9290c3991ef65b8db703c6153dc73 to your computer and use it in GitHub Desktop.
Save HonzaMac/02f9290c3991ef65b8db703c6153dc73 to your computer and use it in GitHub Desktop.
Run node:test runner via node isOdd.test.js
// Run via: node isOdd.test.js
import test from 'node:test'
import assert from 'assert'
const isOdd = (val) => val % 2
test('isOdd', () => {
[[1, true], [2, false]].forEach(([input, expected]) => {
test(`Is Odd for value ${input}`, () => {
assert.equal(isOdd(input), expected)
})
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment