-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
relate.test.ts
51 lines (42 loc) · 874 Bytes
/
relate.test.ts
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
import { suite as createSuite } from 'uvu'
import * as assert from 'uvu/assert'
import * as pipes from '../../src/pipes'
const suite = createSuite('relate pipes (node)')
suite(`relate`, () => {
// Relates to selected
assert.is(
pipes.relate(' ', '.haha')('.business'),
'.haha .business'
)
// Selected defaults to universal
assert.is(
pipes.relate(' ', '.haha')(),
'.haha *'
)
})
// Everything else is an API for relate
suite(`descendant`, () => {
assert.is(
pipes.descendant('.haha')(),
'.haha *'
)
})
suite(`directChild`, () => {
assert.is(
pipes.directChild('.haha')(),
'.haha > *'
)
})
suite(`generalSibling`, () => {
assert.is(
pipes.generalSibling('.haha')(),
'.haha ~ *'
)
})
suite(`adjacentSibling`, () => {
assert.is(
pipes.adjacentSibling('.haha')(),
'.haha + *'
)
})
suite.run()