-
-
Notifications
You must be signed in to change notification settings - Fork 750
Expand file tree
/
Copy pathhopeThat_test.js
More file actions
27 lines (24 loc) · 698 Bytes
/
hopeThat_test.js
File metadata and controls
27 lines (24 loc) · 698 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
const { expect } = require('chai')
const { hopeThat } = require('../../lib/effects')
const recorder = require('../../lib/recorder')
describe('effects', () => {
describe('hopeThat', () => {
beforeEach(() => {
recorder.start()
})
it('should execute command on success', async () => {
const ok = await hopeThat(() => recorder.add(() => 5))
expect(true).is.equal(ok)
return recorder.promise()
})
it('should execute command on fail', async () => {
const notOk = await hopeThat(() =>
recorder.add(() => {
throw new Error('Ups')
}),
)
expect(false).is.equal(notOk)
return recorder.promise()
})
})
})