Created
April 9, 2018 12:49
-
-
Save nabrown/cbf6fe5c0dee202adf5c4f988d2b55fd to your computer and use it in GitHub Desktop.
A test for a function getRandosFromArray
This file contains hidden or 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
test('getRandosFromArray returns an array of n random items from an array', () => { | |
let array = [{id: 1}, {id: 2}, {id: 3}, {id: 4}, {id: 5}, {id: 6}, {id: 7}, {id: 8}, {id: 9}] | |
let n = 2 | |
let items = utils.getRandosFromArray(array, n) | |
expect(items.length).toBe(n) | |
expect(array).toContain(items[0]) | |
expect(array).toContain(items[1]) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment