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