Skip to content

Commit

Permalink
test update
Browse files Browse the repository at this point in the history
  • Loading branch information
Yanis Benson committed Jun 28, 2019
1 parent e00af5e commit 4f7d08d
Showing 1 changed file with 3 additions and 22 deletions.
25 changes: 3 additions & 22 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,31 +26,12 @@ test('debounces a function', async t => {
t.is(count, 2);
});

test('before:false after:false options', async t => {
let count = 0;

const debounced = debounceFn(value => {
count++;
return value;
}, {
test('before:false after:false options', t => {
t.throws(() => debounceFn(() => null, {
wait: 20,
before: false,
after: false
});

t.is(debounced(1), undefined);
t.is(debounced(2), undefined);
t.is(debounced(3), undefined);
t.is(count, 0);

await delay(100);
t.is(debounced(4), undefined);
t.is(debounced(5), undefined);
t.is(debounced(6), undefined);
t.is(count, 0);

await delay(200);
t.is(count, 0);
}), 'Both `before` and `after` are false, function wouldn\'t be called.');
});

test('before:true after:false options', async t => {
Expand Down

0 comments on commit 4f7d08d

Please sign in to comment.