-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.js
More file actions
21 lines (15 loc) · 735 Bytes
/
test.js
File metadata and controls
21 lines (15 loc) · 735 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const memoization = require('./memoizaton');
const expect = require('chai').expect;
// hint: use https://sinonjs.org/releases/v6.1.5/fake-timers/ for faking timeouts
describe('memoization', function () {
it('should memoize function result', () =>{
let returnValue = 5;
const testFunction = (key) => returnValue;
const memoized = memoization.memoize(testFunction, (key) => key, 1000);
expect(memoized('c544d3ae-a72d-4755-8ce5-d25db415b776')).to.equal(5);
returnValue = 10;
// TODO currently fails, should work after implementing the memoize function
expect(memoized('c544d3ae-a72d-4755-8ce5-d25db415b776')).to.equal(5);
});
// TODO additional tests required
});