* chore: make aware eslint that we use jest By setting up the jest environment, we no longer need to declare the 'test' global in the configuration. * chore: don't need to import expect, it's a jest environment global * chore: don't need to import expect when creating undefined test
14 lines
358 B
JavaScript
14 lines
358 B
JavaScript
const {once} = require('./_30s.js');
|
|
|
|
test('once is a Function', () => {
|
|
expect(once).toBeInstanceOf(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);
|
|
});
|