Additional tests

This commit is contained in:
Angelos Chalaris
2018-11-10 13:38:34 +02:00
parent 996dcdc22d
commit 1e82f5f06f
6 changed files with 45 additions and 3 deletions

View File

@ -4,6 +4,11 @@ const {once} = require('./_30s.js');
test('once is a Function', () => {
expect(once).toBeInstanceOf(Function);
});
test('once is a Function', () => {
test('once returns Function', () => {
expect(typeof once(x => 10)).toBe('function');
});
test('once returns the result only once', () => {
let onced = once(x => x);
expect(onced(10)).toBe(10);
expect(onced(10)).toBe(undefined);
});