|
1 | | -import test from 'tape' |
| 1 | +import nodeAssert from 'node:assert/strict' |
| 2 | +import test from 'node:test' |
2 | 3 | import {assert} from '../index.js' |
3 | 4 |
|
4 | | -test('assert(definition)', (t) => { |
5 | | - t.throws( |
| 5 | +test('assert(definition)', () => { |
| 6 | + nodeAssert.throws( |
6 | 7 | () => { |
7 | 8 | assert({type: 'definition'}) |
8 | 9 | }, |
9 | 10 | /`identifier` must be `string`: `{ type: 'definition' }`$/, |
10 | 11 | 'should throw if `definition` has no `identifier`' |
11 | 12 | ) |
12 | 13 |
|
13 | | - t.throws( |
| 14 | + nodeAssert.throws( |
14 | 15 | () => { |
15 | 16 | assert({type: 'definition', identifier: '1'}) |
16 | 17 | }, |
17 | 18 | /`url` must be `string`: `{ type: 'definition', identifier: '1' }`$/, |
18 | 19 | 'should throw if `definition` has no `url`' |
19 | 20 | ) |
20 | 21 |
|
21 | | - t.throws( |
| 22 | + nodeAssert.throws( |
22 | 23 | () => { |
23 | 24 | assert({type: 'definition', identifier: 1}) |
24 | 25 | }, |
25 | 26 | /`identifier` must be `string`: `{ type: 'definition', identifier: 1 }`$/, |
26 | 27 | 'should throw if `identifier` is not a `string`' |
27 | 28 | ) |
28 | 29 |
|
29 | | - t.throws( |
| 30 | + nodeAssert.throws( |
30 | 31 | () => { |
31 | 32 | assert({type: 'definition', url: 1}) |
32 | 33 | }, |
33 | 34 | /`identifier` must be `string`: `{ type: 'definition', url: 1 }`$/, |
34 | 35 | 'should throw if `url` is not a `string`' |
35 | 36 | ) |
36 | 37 |
|
37 | | - t.doesNotThrow(() => { |
| 38 | + nodeAssert.doesNotThrow(() => { |
38 | 39 | assert({type: 'definition', identifier: '1', url: '1'}) |
39 | 40 | }, 'should not throw if `definition` has no other properties') |
40 | 41 |
|
41 | | - t.throws( |
| 42 | + nodeAssert.throws( |
42 | 43 | () => { |
43 | 44 | assert({type: 'definition', identifier: '1', url: '1', title: 1}) |
44 | 45 | }, |
45 | 46 | /`title` must be `string`: `{ type: 'definition', identifier: '1', url: '1', title: 1 }`$/, |
46 | 47 | 'should throw if `title` is not a `string`' |
47 | 48 | ) |
48 | 49 |
|
49 | | - t.throws( |
| 50 | + nodeAssert.throws( |
50 | 51 | () => { |
51 | 52 | assert({type: 'definition', identifier: '1', url: '1', label: 1}) |
52 | 53 | }, |
53 | 54 | /`label` must be `string`: `{ type: 'definition', identifier: '1', url: '1', label: 1 }`$/, |
54 | 55 | 'should throw if `label` is not a `string`' |
55 | 56 | ) |
56 | | - |
57 | | - t.end() |
58 | 57 | }) |
0 commit comments