You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
646 B
33 lines
646 B
7 years ago
|
const isEq = require('@codefeathers/iseq');
|
||
|
|
||
|
const { liftPromise, stringify } = require('../../util/helpers');
|
||
|
const _assertPromise = require('./assertPromise');
|
||
|
|
||
|
const expect = a => {
|
||
|
|
||
|
return ({
|
||
|
done : () => Promise.resolve(),
|
||
|
equal : (b) =>
|
||
|
liftPromise(
|
||
|
x => _assertPromise(
|
||
|
x === b,
|
||
|
`${a} is not equal to ${b}`),
|
||
|
a),
|
||
|
deepEqual : b =>
|
||
|
liftPromise(
|
||
|
x => _assertPromise(
|
||
|
isEq(x, b),
|
||
|
`${stringify(a)} is not deeply equal to ${stringify(b)}`,
|
||
|
a),
|
||
|
a),
|
||
|
isTrue : () =>
|
||
|
liftPromise(
|
||
|
x => _assertPromise(
|
||
|
x === true,
|
||
|
`${a} is not true`),
|
||
|
a),
|
||
|
});
|
||
|
};
|
||
|
|
||
|
module.exports = expect;
|