Test migration to jest by hand
Apparently using regular expressions is way easier.
This commit is contained in:
5
test/isPromiseLike/isPromiseLike.js
Normal file
5
test/isPromiseLike/isPromiseLike.js
Normal file
@ -0,0 +1,5 @@
|
||||
const isPromiseLike = obj =>
|
||||
obj !== null &&
|
||||
(typeof obj === 'object' || typeof obj === 'function') &&
|
||||
typeof obj.then === 'function';
|
||||
module.exports = isPromiseLike;
|
||||
16
test/isPromiseLike/isPromiseLike.test.js
Normal file
16
test/isPromiseLike/isPromiseLike.test.js
Normal 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');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user