Commit 755537ef authored by Stefanie Hasler's avatar Stefanie Hasler
Browse files

tcr

parent 2f75fc9e
...@@ -21,6 +21,8 @@ class MarsRover { ...@@ -21,6 +21,8 @@ class MarsRover {
case 'E': this.dir = 'S' case 'E': this.dir = 'S'
break break
case 'S': this.dir = 'W' case 'S': this.dir = 'W'
break
case 'W': this.dir = 'N'
} }
return this return this
} }
...@@ -45,6 +47,10 @@ describe("MarsRover", () => { ...@@ -45,6 +47,10 @@ describe("MarsRover", () => {
it('should turn right three times, then point west', () => { it('should turn right three times, then point west', () => {
expect(new MarsRover().right().right().right().pos()).to.equal('0,0,W') expect(new MarsRover().right().right().right().pos()).to.equal('0,0,W')
})
it('should turn right four times, then point north', () => {
expect(new MarsRover().right().right().right().right().pos()).to.equal('0,0,N')
}) })
}) })
\ 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