mirror of
https://github.com/cypress-io/cypress.git
synced 2026-05-03 05:20:38 -05:00
c6f5e9a5c9
* fix: ensure that we capture service worker requests * add changelog * fix changelog * fix tests * PR comments * PR comments * PR comment * PR comment * update changelog * Update cli/CHANGELOG.md Co-authored-by: Mike McCready <66998419+MikeMcC399@users.noreply.github.com> * enable builds on all archs * fix permission issue * PR comments * Update smoke.js * Update cli/CHANGELOG.md * attempt to fix smoke tests * bump ci cache * Update smoke.js * Update smoke.js * Update example.json * fix multiple specs * fix tests * Update CHANGELOG.md --------- Co-authored-by: Mike McCready <66998419+MikeMcC399@users.noreply.github.com>
35 lines
906 B
JavaScript
35 lines
906 B
JavaScript
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)
|
|
})
|
|
})
|
|
})
|