-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Expand file tree
/
Copy pathautomation_spec.js
More file actions
34 lines (24 loc) · 906 Bytes
/
automation_spec.js
File metadata and controls
34 lines (24 loc) · 906 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
28
29
30
31
32
33
34
require('../spec_helper')
const _ = require('lodash')
const { Automation } = require(`../../lib/automation`)
describe('lib/automation', () => {
beforeEach(function () {
this.automation = new Automation({})
})
context('.reset', () => {
it('resets middleware', function () {
const m = this.automation.getMiddleware()
// all props are null by default
expect(_.omitBy(m, _.isNull)).to.deep.eq({})
const onRequest = function () {}
const onPush = function () {}
this.automation.use({ onRequest, onPush })
expect(this.automation.getMiddleware().onRequest).to.eq(onRequest)
expect(this.automation.getMiddleware().onPush).to.eq(onPush)
this.automation.reset()
expect(this.automation.getMiddleware().onRequest).to.be.null
// keep around onPush
expect(this.automation.getMiddleware().onPush).to.eq(onPush)
})
})
})