-
Notifications
You must be signed in to change notification settings - Fork 3
/
test.js
25 lines (22 loc) · 897 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { strict as assert } from "node:assert"
import { test } from "node:test"
import no from './not-defined.js'
test('not-defined', () => {
assert.ok(no(), 'no param')
assert.ok(no(undefined), 'undefined')
assert.ok(no(null), 'null')
assert.ok(no(''), 'empty string')
assert.ok(no([]), 'empty array')
assert.ok(no({}), 'empty object')
assert.ok(no(NaN), 'not a number')
assert.ok(!no(0), '0 is defined')
assert.ok(!no(true), 'true is defined')
assert.ok(!no(false), 'false is defined')
assert.ok(!no('string'), 'a string is defined')
assert.ok(!no(['foo']), 'an array is defined')
assert.ok(!no({foo: true}), 'an object is defined')
assert.ok(!no(42), '"the answer" is defined')
assert.ok(!no(Infinity), 'Infinity is defined')
assert.ok(!no(function () { return 1 }), 'A function with no arguments is defined')
assert.ok(!no(0n), '0 bigint is defined')
})