-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.test.js
31 lines (24 loc) · 1.51 KB
/
index.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const carryGifts = require('./index.js')
describe('Challenge 17', () => {
test("Test #01 - expect return type array", () => {
expect(typeof carryGifts([], 1)).toBe('object')
})
test(`Test #02 - expect carryGifts(['game', 'bike', 'book', 'toy'], 10) to be ["game bike","book toy"]`, () => {
expect(carryGifts(['game', 'bike', 'book', 'toy'], 10)).toEqual(["game bike", "book toy"])
})
test(`Test #03 - expect carryGifts(['game', 'bike', 'book', 'toy'], 7) to be ["game","bike","book toy"]`, () => {
expect(carryGifts(['game', 'bike', 'book', 'toy'], 7)).toEqual(["game", "bike", "book toy"])
})
test(`Test #04 - expect carryGifts(['game', 'bike', 'book', 'toy'], 4) to be ["game","bike","book","toy"]`, () => {
expect(carryGifts(['game', 'bike', 'book', 'toy'], 4)).toEqual(["game", "bike", "book", "toy"])
})
test(`Test #05 - expect carryGifts(['toy', 'gamme', 'toy', 'bike'], 6) to be ["toy","gamme","toy","bike"]`, () => {
expect(carryGifts(['toy', 'gamme', 'toy', 'bike'], 6)).toEqual(["toy", "gamme", "toy", "bike"])
})
test(`Test #06 - expect carryGifts(['toy', 'toy', 'toy', 'toy'], 2) to be []`, () => {
expect(carryGifts(['toy', 'toy', 'toy', 'toy'], 2)).toEqual([])
})
test(`Test #07 - expect carryGifts(['toy', 'toy', 'disk', 'disk', 'toy', 'toy'], 7) to ["toy toy","disk","disk toy","toy"]`, () => {
expect(carryGifts(['toy', 'toy', 'disk', 'disk', 'toy', 'toy'], 7)).toEqual(["toy toy", "disk", "disk toy", "toy"])
})
})