Test migration to jest by hand
Apparently using regular expressions is way easier.
This commit is contained in:
14
test/memoize/memoize.test.js
Normal file
14
test/memoize/memoize.test.js
Normal file
@ -0,0 +1,14 @@
|
||||
const expect = require('expect');
|
||||
const memoize = require('./memoize.js');
|
||||
|
||||
|
||||
test('memoize is a Function', () => {
|
||||
expect(memoize).toBeInstanceOf(Function);
|
||||
});
|
||||
const f = x => x * x;
|
||||
const square = memoize(f);
|
||||
t.equal(square(2), 4, 'Function works properly');
|
||||
t.equal(square(3), 9, 'Function works properly');
|
||||
t.deepEqual(Array.from(square.cache), [[2,4],[3,9]], 'Cache stores values');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user