Last active
January 31, 2018 09:01
-
-
Save sebv/50c3481ab33ebd9b93cb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sinon = require('sinon'), | |
support = require('appium-support'), | |
Q = require('q'), | |
chai = require("chai"); | |
should = chai.should(); | |
function actualLogic(cmd) { | |
return support.core.exec("sleep 10000 && " + cmd).then(function(res) { | |
return res[0].toUpperCase(); | |
}); | |
} | |
describe('example', function() { | |
it("should work", function() { | |
var mock = sinon.mock(support.core); | |
mock.expects("exec").once().withArgs('sleep 10000 && echo "hello world"').returns(new Q(['hello world', null])); | |
return actualLogic('echo "hello world"').then(function(res){ | |
res.should.equal('HELLO WORLD'); | |
}).finally(function(){ | |
mock.verify(); | |
mock.restore(); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
(It also looks like @mentions don't work in gists?)