cli: fix unit test for windows

This commit is contained in:
Gleb Bahmutov
2017-09-27 15:01:01 -04:00
parent c3d77d097c
commit 907254b2ac
3 changed files with 16 additions and 2 deletions
+1
View File
@@ -54,6 +54,7 @@
"babel-preset-es2015": "^6.24.1",
"bin-up": "^1.1.0",
"chai": "^3.5.0",
"chai-string": "1.4.0",
"clear-module": "^2.1.0",
"dependency-check": "^2.8.0",
"execa-wrap": "1.1.0",
+14 -2
View File
@@ -81,6 +81,13 @@ describe('info', function () {
})
})
context('.getPathToExecutable', function () {
it('resolves path on windows', function () {
this.sandbox.stub(os, 'platform').returns('win32')
expect(info.getPathToExecutable()).to.endWith('.exe')
})
})
context('.getPathToUserExecutableDir', function () {
it('resolves path on macOS', function () {
this.sandbox.stub(os, 'platform').returns('darwin')
@@ -92,9 +99,14 @@ describe('info', function () {
expect(info.getPathToUserExecutableDir()).to.equal(path.join(installationDir, 'Cypress'))
})
it('rejects on anything else', function () {
it('resolves path on windows', function () {
this.sandbox.stub(os, 'platform').returns('win32')
expect(() => info.getPathToUserExecutableDir()).to.throw('Platform: "win32" is not supported.')
expect(info.getPathToUserExecutableDir()).to.endWith('Cypress')
})
it('rejects on anything else', function () {
this.sandbox.stub(os, 'platform').returns('unknown')
expect(() => info.getPathToUserExecutableDir()).to.throw('Platform: "unknown" is not supported.')
})
})
+1
View File
@@ -7,6 +7,7 @@ global.lib = path.join(__dirname, '..', 'lib')
require('chai')
.use(require('@cypress/sinon-chai'))
.use(require('chai-string'))
beforeEach(function () {
this.sandbox = sinon.sandbox.create().usingPromise(Promise)