This repository has been archived on 2018-10-12. You can view files and clone it, but cannot push or open issues or pull requests.
crispy-train/test/unit/helpers/promisify_test.js

21 lines
660 B
JavaScript
Raw Normal View History

2016-02-18 21:50:45 -05:00
'use strict';
const testBase = require('../../test-base');
const expect = testBase.expect;
const fs = require('fs');
const promisify = testBase.require('app/helpers/promisify');
suite('Promisify', () => {
test('Promisify returns a promise', () => {
let actual = promisify(fs.readFile)('../../test-base.js');
expect(actual).to.be.a('Promise');
});
test('Promisify fs.readFile resolves', () => {
let actual = promisify(fs.readFile)('../../test-base.js');
expect(actual).to.be.fulfilled;
});
test('Promisify fs.readFile fails on non-existent file', () => {
let actual = promisify(fs.readFile)('foo.txt');
expect(actual).to.be.rejected;
});
});