-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixing bug related to skier crash state
- Loading branch information
1 parent
dfbad20
commit bec8548
Showing
2 changed files
with
56 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import "babel-polyfill"; | ||
import * as Constants from "../Constants"; | ||
import { Skier } from "./Skier"; | ||
|
||
|
||
describe('when skier crashed', () => { | ||
|
||
let skier, fake; | ||
|
||
beforeEach(() => { | ||
skier = new Skier(0, 0); | ||
fake = jest.fn(); | ||
skier.direction = Constants.SKIER_DIRECTIONS.CRASH; | ||
}); | ||
|
||
describe('on left key stroke', () => { | ||
|
||
test('turn left should set direction as left', () => { | ||
skier.turnLeft(); | ||
expect(skier.direction).toBe(Constants.SKIER_DIRECTIONS.LEFT); | ||
}); | ||
|
||
test('turn left should move skier to left side', () => { | ||
skier.moveSkierLeft = fake; | ||
skier.turnLeft(); | ||
expect(fake.mock.calls.length).toBe(1); | ||
}); | ||
}) | ||
|
||
describe('on righ key stroke', () => { | ||
test('turn righ should set direction as right', () => { | ||
skier.turnRight(); | ||
expect(skier.direction).toBe(Constants.SKIER_DIRECTIONS.RIGHT); | ||
}); | ||
|
||
test('turn right should move skier to right side', () => { | ||
skier.moveSkierRight = fake; | ||
skier.turnRight(); | ||
expect(fake.mock.calls.length).toBe(1); | ||
}); | ||
}); | ||
}); |