-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.test.js
44 lines (38 loc) · 1.2 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
32
33
34
35
36
37
38
39
40
41
42
43
44
import canMouseEat from './index'
describe('Day 25 challenge', () => {
test('checks the mouse movements in the first room', () => {
const room = [
[' ', ' ', ' '],
[' ', ' ', 'm'],
[' ', ' ', '*'],
]
expect(canMouseEat('up', room)).toBeFalsy()
expect(canMouseEat('down', room)).toBeTruthy()
expect(canMouseEat('right', room)).toBeFalsy()
expect(canMouseEat('left', room)).toBeFalsy()
})
test('checks the mouse movements in the second room', () => {
const room = [
['*', ' ', ' ', ' '],
[' ', 'm', '*', ' '],
[' ', ' ', ' ', ' '],
[' ', ' ', ' ', '*'],
]
expect(canMouseEat('up', room)).toBeFalsy()
expect(canMouseEat('down', room)).toBeFalsy()
expect(canMouseEat('right', room)).toBeTruthy()
expect(canMouseEat('left', room)).toBeFalsy()
})
// Additional tests
test('checks the mouse movements from a corner', () => {
const room = [
[' ', ' ', ' '],
[' ', ' ', '*'],
[' ', ' ', 'm'],
]
expect(canMouseEat('up', room)).toBeTruthy()
expect(canMouseEat('down', room)).toBeFalsy()
expect(canMouseEat('right', room)).toBeFalsy()
expect(canMouseEat('left', room)).toBeFalsy()
})
})