mirror of
https://github.com/cypress-io/cypress.git
synced 2026-02-04 14:19:55 -06:00
add tests for cli
This commit is contained in:
37
test/cli_spec.js
Normal file
37
test/cli_spec.js
Normal file
@@ -0,0 +1,37 @@
|
||||
require('./spec_helper')
|
||||
|
||||
const cli = require('../lib/cli')
|
||||
const download = require('../lib/download')
|
||||
const downloadUtils = require('../lib/download/utils')
|
||||
const run = require('../lib/exec/run')
|
||||
const open = require('../lib/exec/open')
|
||||
|
||||
describe('cli', function () {
|
||||
beforeEach(function () {
|
||||
this.exec = (args) => cli.init().parse(`node test ${args}`.split(' '))
|
||||
})
|
||||
|
||||
it('run calls run#start with options', function () {
|
||||
this.sandbox.stub(run, 'start')
|
||||
this.exec('run --port 7878')
|
||||
expect(run.start).to.be.calledWith({ port: '7878' })
|
||||
})
|
||||
|
||||
it('open calls open#start with options', function () {
|
||||
this.sandbox.stub(open, 'start')
|
||||
this.exec('open --port 7878')
|
||||
expect(open.start).to.be.calledWith({ port: '7878' })
|
||||
})
|
||||
|
||||
it('install calls download#install with force: true', function () {
|
||||
this.sandbox.stub(download, 'install')
|
||||
this.exec('install')
|
||||
expect(download.install).to.be.calledWith({ force: true })
|
||||
})
|
||||
|
||||
it('verify calls downloadUtils#verify with force: true', function () {
|
||||
this.sandbox.stub(downloadUtils, 'verify')
|
||||
this.exec('verify')
|
||||
expect(downloadUtils.verify).to.be.calledWith({ force: true })
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user