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.
ProgBlog/test/unit/helpers/promisify_test.js

21 lines
660 B
JavaScript
Raw Normal View History

2016-02-19 12:58:16 -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;
});
});