forked from skozin/nyc-babel-issue-repro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
34 lines (27 loc) · 730 Bytes
/
test.js
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
import test from 'ava'
import {Chan} from '.'
import {STATE_NORMAL, STATE_WAITING_FOR_PUBLISHER, STATE_CLOSING, STATE_CLOSED} from '.'
import {TYPE_VALUE, TYPE_ERROR} from '.'
const TEST_BUFFER = [
{ fnVal: nop }, { fnErr: nop },
{ fnVal: nop }, { fnErr: nop },
{ fnVal: nop }, { fnErr: nop },
{ fnVal: nop }, { fnErr: nop }
]
test('this provides complete coverage', t => {
let ch = new Chan()
takeItAll(ch)
ch._state = STATE_NORMAL
ch._buffer = []
takeItAll(ch)
ch._state = STATE_NORMAL
ch._buffer = TEST_BUFFER.slice()
takeItAll(ch)
t.pass()
})
function takeItAll(ch) {
for (let i = 0; i < 8; ++i) {
ch.take(0 != (i & 0b100), 0 != (i & 0b010), 0 != (i & 0b001))
}
}
function nop() {}