Skip to content

Commit a40a006

Browse files
committed
Refactor code-style
1 parent 5d8d15c commit a40a006

File tree

1 file changed

+19
-24
lines changed

1 file changed

+19
-24
lines changed

test.js

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,28 @@ import assert from 'node:assert/strict'
22
import test from 'node:test'
33
import {h} from 'hastscript'
44
import {headingRank} from './index.js'
5-
import * as mod from './index.js'
65

7-
test('headingRank', () => {
8-
assert.deepEqual(
9-
Object.keys(mod).sort(),
10-
['headingRank'],
11-
'should expose the public api'
12-
)
6+
test('headingRank', async function (t) {
7+
await t.test('should expose the public api', async function () {
8+
assert.deepEqual(Object.keys(await import('./index.js')).sort(), [
9+
'headingRank'
10+
])
11+
})
1312

14-
// @ts-expect-error runtime.
15-
assert.equal(headingRank(), null, 'should return null for non-nodes')
13+
await t.test('should return null for non-nodes', async function () {
14+
// @ts-expect-error runtime.
15+
assert.equal(headingRank(), null)
16+
})
1617

17-
assert.equal(
18-
headingRank({type: 'text', value: '!'}),
19-
null,
20-
'should return null for non-elements'
21-
)
18+
await t.test('should return null for non-elements', async function () {
19+
assert.equal(headingRank({type: 'text', value: '!'}), null)
20+
})
2221

23-
assert.equal(
24-
headingRank(h('p', '!')),
25-
null,
26-
'should return null for non-headings'
27-
)
22+
await t.test('should return null for non-headings', async function () {
23+
assert.equal(headingRank(h('p', '!')), null)
24+
})
2825

29-
assert.equal(
30-
headingRank(h('h5', '!')),
31-
5,
32-
'should return the rank of a heading'
33-
)
26+
await t.test('should return the rank of a heading', async function () {
27+
assert.equal(headingRank(h('h5', '!')), 5)
28+
})
3429
})

0 commit comments

Comments
 (0)