-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest-default.js
48 lines (41 loc) · 1.13 KB
/
test-default.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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import assert from 'node:assert/strict'
import test from 'node:test'
import {deprecate, equal, ok, unreachable} from 'devlop'
test('deprecate', async function (t) {
await t.test('should not show a deprecation message', function () {
const consoleError = console.error
let deprecatedCalled = false
let consoleErrorCalled = false
const dep = deprecate(function () {
deprecatedCalled = true
}, 'deprecated!')
console.error = () => {
consoleErrorCalled = true
}
dep()
console.error = consoleError
assert.ok(deprecatedCalled)
assert.ok(!consoleErrorCalled)
})
})
test('equal', async function (t) {
await t.test('should not fail on a false assertion', function () {
assert.doesNotThrow(function () {
equal(true, false)
})
})
})
test('ok', async function (t) {
await t.test('should not fail on a false assertion', function () {
assert.doesNotThrow(function () {
ok(false)
})
})
})
test('unreachable', async function (t) {
await t.test('should not fail on `unreachable`', function () {
assert.doesNotThrow(function () {
unreachable()
})
})
})