-
Notifications
You must be signed in to change notification settings - Fork 4
/
test.js
39 lines (33 loc) · 931 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
35
36
37
38
39
const tape = require('tape')
const plus = require('./example/plus')
tape('a trivial test case', t => {
t.notEqual(36, 44, 'that passes')
t.end()
})
tape('add numbers', t => {
t.equal(plus(2, 2), 4)
t.end()
})
tape('a browser test case', async t => {
const res = await fetch('https://raw.githubusercontent.com/chiefbiiko/tape-puppet/master/package.json')
const pkg = await res.json()
t.equal(pkg.name, 'tape-puppet', 'just used the browser\'s fetch API')
t.end()
})
tape('yet another browser test case', t => {
var btn = document.createElement('button')
btn.onclick = e => {
t.true(e.target.isSameNode(btn), 'proper browser event')
document.body.removeChild(btn)
btn = null
t.end()
}
document.body.appendChild(btn)
btn.click()
})
tape.skip('a debug test', t => { // included for demo, skipped for CI automation
var y, z = 'v'
;debugger;
t.equal(y, z, 'y equals z')
t.end()
})