-
-
Notifications
You must be signed in to change notification settings - Fork 135
/
Copy pathindex.test.mjs
54 lines (43 loc) · 1.27 KB
/
index.test.mjs
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
49
50
51
52
53
54
import { describe, it } from 'node:test';
import assert from 'assert';
import { isValidElement } from 'react';
import parse, {
attributesToProps,
Comment,
domToReact,
Element,
htmlToDOM,
ProcessingInstruction,
Text,
} from '../../esm/index.mjs';
describe('index', () => {
it('exports "parse" function', () => {
assert.strictEqual(typeof parse, 'function');
});
it('parses HTML to React element', () => {
assert.ok(isValidElement(parse('<p>text</p>')));
});
it('exports "attributesToProps" function', () => {
assert.strictEqual(typeof attributesToProps, 'function');
});
it('exports "domToReact" function', () => {
assert.strictEqual(typeof domToReact, 'function');
});
it('exports "htmlToDOM" function', () => {
assert.strictEqual(typeof htmlToDOM, 'function');
});
});
describe('domhandler', () => {
it('exports "Comment" function', () => {
assert.strictEqual(typeof Comment, 'function');
});
it('exports "Element" function', () => {
assert.strictEqual(typeof Element, 'function');
});
it('exports "ProcessingInstruction" function', () => {
assert.strictEqual(typeof ProcessingInstruction, 'function');
});
it('exports "Text" function', () => {
assert.strictEqual(typeof Text, 'function');
});
});