Test migration to jest by hand

Apparently using regular expressions is way easier.
This commit is contained in:
Angelos Chalaris
2018-06-18 15:15:56 +03:00
parent 977949ca61
commit 4f7da1be9b
894 changed files with 5917 additions and 3607 deletions

View File

@ -0,0 +1,5 @@
const isPromiseLike = obj =>
obj !== null &&
(typeof obj === 'object' || typeof obj === 'function') &&
typeof obj.then === 'function';
module.exports = isPromiseLike;

View File

@ -0,0 +1,16 @@
const expect = require('expect');
const isPromiseLike = require('./isPromiseLike.js');
test('isPromiseLike is a Function', () => {
expect(isPromiseLike).toBeInstanceOf(Function);
});
t.equal(isPromiseLike({
then: function() {
return '';
}
}), true, 'Returns true for a promise-like object');
t.equal(isPromiseLike(null), false, 'Returns false for null');
t.equal(isPromiseLike({}), false, 'Returns false for an empty object');