-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
43 lines (38 loc) · 896 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
40
41
42
43
import test from 'ava'
import childProcess from 'child_process'
import api from './api.js'
test.cb('--all', t => {
// For Windows
const cp = childProcess.spawn('node ./index.js --all', { shell: true })
cp.on('error', t.ifError)
cp.on('close', code => {
t.is(code, 0)
t.end()
})
})
test.cb('-vcugid', t => {
// For Windows
const cp = childProcess.spawn('node ./index.js -vugid', { shell: true })
cp.on('error', t.ifError)
cp.on('close', code => {
t.is(code, 0)
t.end()
})
})
test.cb('no options passed', t => {
// For Windows
const cp = childProcess.spawn('node ./index.js', { shell: true })
cp.on('error', t.ifError)
cp.on('close', code => {
t.is(code, 0)
t.end()
})
})
test('api call', async t => {
try {
const status = await api
t.true(status.wan.online)
} catch (err) {
t.is(err, 'Your Google Wifi is offline.')
}
})