Created
January 20, 2017 20:08
-
-
Save louisptremblay/cf008055aea392b5bfa4f5481c01d624 to your computer and use it in GitHub Desktop.
This file contains 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
let Tools; | |
let getMock; | |
describe('Tools', () => { | |
beforeEach(() => { | |
Tools = proxyquire('../Tools', { | |
'../../../utils/api/requests': { get: getMock }, | |
}); | |
}); | |
describe('fileExists', () => { | |
it('should return true if the file exists', () => { | |
getMock = () => ({ status: 200, json: () => Promise.resolve('exists') }); | |
const exists = Tools.fileExists('foobar.txt'); | |
return exists.then(v => expect(v).to.be.true); | |
}); | |
it('should return false if the file doesnt exist', () => { | |
getMock = () => ({ status: 400 }); | |
const exists = Tools.fileExists('foobar.txt'); | |
return exists.then(v => expect(v).to.be.false); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment