Commit 103e54ab authored by Stefanie Hasler's avatar Stefanie Hasler

tcr

parent 2608e141
...@@ -42,6 +42,16 @@ class MarsRover { ...@@ -42,6 +42,16 @@ class MarsRover {
} }
return this return this
} }
left(): MarsRover {
switch(this.dir) {
case 'N':
this.dir = 'W'
break
}
return this
}
} }
describe("MarsRover", () => { describe("MarsRover", () => {
...@@ -80,4 +90,8 @@ describe("MarsRover", () => { ...@@ -80,4 +90,8 @@ describe("MarsRover", () => {
it('should move west', () => { it('should move west', () => {
expect(new MarsRover().right().right().right().forward().pos()).to.equal('-1,0,W') expect(new MarsRover().right().right().right().forward().pos()).to.equal('-1,0,W')
}) })
it('should turn left', () => {
expect(new MarsRover().left().pos()).to.equal('0,0,W')
})
}) })
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment