-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.mjs
More file actions
33 lines (28 loc) · 737 Bytes
/
test.mjs
File metadata and controls
33 lines (28 loc) · 737 Bytes
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
import test from 'tape'
import { parse, fragment, serialize, serializeOuter } from './parse5.mjs'
test('parse should exist', t => {
t.ok(parse)
t.end()
})
test('fragment should exist', t => {
t.ok(fragment)
t.end()
})
test('serialize should exist', t => {
t.ok(serialize)
t.end()
})
test('serializeOuter should exist', t => {
t.ok(serializeOuter)
t.end()
})
test('parse to serialize. End to end', t => {
const input = '<div>Hi there!</div>'
const document = parse(input)
const outer = serializeOuter(document.childNodes[0])
const actual = serialize(document)
const expected = '<html><head></head><body><div>Hi there!</div></body></html>'
t.equal(actual, expected)
t.equal(outer, expected)
t.end()
})