Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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);
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement