-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b27b1dd
commit 7f9a991
Showing
13 changed files
with
441 additions
and
848 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,7 @@ | ||
const R = require('../rambdax') | ||
|
||
describe('intersection', () => { | ||
it('', () => { | ||
expect( | ||
R.intersection([ 1, 3, 5 ], [ 2, 3, 5 ]) | ||
).toEqual([ 3, 5 ]) | ||
}) | ||
}) | ||
test('', () => { | ||
expect( | ||
R.intersection([ 1, 3, 5 ], [ 2, 3, 5 ]) | ||
).toEqual([ 3, 5 ]) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,35 @@ | ||
const { throttle } = require('../rambdax') | ||
const R = require('../rambdax') | ||
|
||
describe('', () => { | ||
it('', async () => { | ||
let counter = 0 | ||
const inc = () => { | ||
counter++ | ||
} | ||
test('', async () => { | ||
let counter = 0 | ||
let aHolder | ||
let bHolder | ||
|
||
const delay = ms => new Promise(resolve => { | ||
setTimeout(resolve, ms) | ||
}) | ||
const incWrapped = throttle(inc, 1000) | ||
await delay(500) | ||
incWrapped() | ||
incWrapped() | ||
incWrapped() | ||
expect(counter).toBe(1) | ||
await delay(1500) | ||
incWrapped() | ||
expect(counter).toBe(2) | ||
}) | ||
const inc = (a,b) => { | ||
aHolder = a | ||
bHolder = b | ||
counter++ | ||
} | ||
|
||
const incWrapped = R.throttle(inc, 1000) | ||
|
||
incWrapped(1,2) | ||
|
||
await R.delay(500) | ||
|
||
incWrapped(2,3) | ||
incWrapped(3,4) | ||
|
||
expect(counter).toBe(1) | ||
expect(aHolder).toBe(1) | ||
expect(bHolder).toBe(2) | ||
|
||
await R.delay(1000) | ||
|
||
incWrapped(5,6) | ||
|
||
expect(counter).toBe(2) | ||
expect(aHolder).toBe(5) | ||
expect(bHolder).toBe(6) | ||
}) | ||
|
Oops, something went wrong.