Skip to content

Commit 001ed11

Browse files
committed
Add tests for exposed identifiers
1 parent 9551cf0 commit 001ed11

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

Diff for: test/core.js

+46
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,52 @@ import test from 'node:test'
33
import {h, s} from '../index.js'
44
import {h as hFromRoot} from '../html.js'
55
import {s as sFromRoot} from '../svg.js'
6+
import * as coreMod from '../index.js'
7+
import * as htmlMod from '../html.js'
8+
import * as svgMod from '../svg.js'
9+
import * as jsxCoreMod from '../jsx-runtime.js'
10+
import * as jsxHtmlMod from '../html/jsx-runtime.js'
11+
import * as jsxSvgMod from '../svg/jsx-runtime.js'
12+
13+
test('api', () => {
14+
const core = Object.keys(coreMod)
15+
assert(core.includes('h'), 'should expose `h` from `.`')
16+
assert(core.includes('s'), 'should expose `s` from `.`')
17+
const html = Object.keys(htmlMod)
18+
assert(html.includes('h'), 'should expose `h` from `/html`')
19+
const svg = Object.keys(svgMod)
20+
assert(svg.includes('s'), 'should expose `s` from `/svg`')
21+
const jsxCore = Object.keys(jsxCoreMod)
22+
assert(
23+
jsxCore.includes('Fragment'),
24+
'should expose `Fragment` from `/jsx-runtime`'
25+
)
26+
assert(jsxCore.includes('jsx'), 'should expose `jsx` from `/jsx-runtime`')
27+
assert(jsxCore.includes('jsxs'), 'should expose `jsxs` from `/jsx-runtime`')
28+
const jsxHtml = Object.keys(jsxHtmlMod)
29+
assert(
30+
jsxHtml.includes('Fragment'),
31+
'should expose `Fragment` from `/html/jsx-runtime`'
32+
)
33+
assert(
34+
jsxHtml.includes('jsx'),
35+
'should expose `jsx` from `/html/jsx-runtime`'
36+
)
37+
assert(
38+
jsxHtml.includes('jsxs'),
39+
'should expose `jsxs` from `/html/jsx-runtime`'
40+
)
41+
const jsxSvg = Object.keys(jsxSvgMod)
42+
assert(
43+
jsxSvg.includes('Fragment'),
44+
'should expose `Fragment` from `/svg/jsx-runtime`'
45+
)
46+
assert(jsxSvg.includes('jsx'), 'should expose `jsx` from `/svg/jsx-runtime`')
47+
assert(
48+
jsxSvg.includes('jsxs'),
49+
'should expose `jsxs` from `/svg/jsx-runtime`'
50+
)
51+
})
652

753
test('hastscript', async (t) => {
854
assert.equal(h, hFromRoot, '`h` should be exposed from `/html.js`')

0 commit comments

Comments
 (0)