Skip to content

Commit

Permalink
Adding tests to ensure normalization happens
Browse files Browse the repository at this point in the history
  • Loading branch information
Aftabnack committed Mar 12, 2018
1 parent beb67a1 commit bdbf78b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
4 changes: 4 additions & 0 deletions cli/__snapshots__/cypress_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@ exports['cypress .run resolves with contents of tmp file 1'] = {
"code": 0,
"failingTests": []
}

exports['cypress .open normalizes config object 1'] = {
"config": "pageLoadTime=10000,watchForFileChanges=false"
}
26 changes: 24 additions & 2 deletions cli/test/lib/cypress_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,32 @@ const cypress = require(`${lib}/cypress`)

describe('cypress', function () {
context('.open', function () {
it('calls open#start, passing in options', function () {
beforeEach(function () {
this.sandbox.stub(open, 'start').resolves()
})

const getCallArgs = R.path(['lastCall', 'args', 0])
const getStartArgs = () => {
expect(open.start).to.be.called
return getCallArgs(open.start)
}

it('calls open#start, passing in options', function () {
cypress.open({ foo: 'foo' })
expect(open.start).to.be.calledWith({ foo: 'foo' })
.then(getStartArgs)
.then((args) => {
expect(args.foo).to.equal('foo')
})
})

it('normalizes config object', () => {
const config = {
pageLoadTime: 10000,
watchForFileChanges: false,
}
cypress.open({ config })
.then(getStartArgs)
.then(snapshot)
})
})

Expand Down

0 comments on commit bdbf78b

Please sign in to comment.