-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.test.ts
30 lines (23 loc) · 959 Bytes
/
index.test.ts
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
import {SquadMover} from "./kata/squad.mover";
describe('Mars Rover Kata', () => {
it('should return steady rover position', () => {
const output = new SquadMover('5 5\n1 2 N').move()
expect(output).toBe('1 2 N')
})
it('should return turning left rover position', () => {
const output = new SquadMover('5 5\n1 2 N\nL').move()
expect(output).toBe('1 2 W')
})
it('should return turning right rover position', () => {
const output = new SquadMover('5 5\n1 2 N\nR').move()
expect(output).toBe('1 2 E')
})
it('should return turning move rover position', () => {
const output = new SquadMover('5 5\n1 2 N\nRM').move()
expect(output).toBe('2 2 E')
})
it('should return double turning move rovers position', () => {
const output = new SquadMover('5 5\n1 2 N\nLMLMLMLMM\n3 3 E\nMMRMMRMRRM').move()
expect(output).toBe('1 3 N\n5 1 E')
})
} )