21 lines
660 B
JavaScript
21 lines
660 B
JavaScript
'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;
|
|
});
|
|
}); |