Skip to content

Instantly share code, notes, and snippets.

@ctrlShiftBryan
Created February 16, 2022 18:04
Show Gist options
  • Save ctrlShiftBryan/c2f7e561eafb68e9938859ad32f8a4ca to your computer and use it in GitHub Desktop.
Save ctrlShiftBryan/c2f7e561eafb68e9938859ad32f8a4ca to your computer and use it in GitHub Desktop.
test.js
class Game {
score(scores) {
// put your code here
}
}
describe(‘Game’, () => {
const subject = new Game();
test(‘when no special scores occur’, () => {
let scores = [1, 2, 3, 4];
expect(subject.score(scores)).toEqual(10);
});
// test(‘when a spare is scored’, () => {
// let scores = [3, 7, 5, 0];
// expect(subject.score(scores)).toEqual(20);
// });
// test(‘when a strike is scored’, () => {
// let scores = [10, 5, 4];
// expect(subject.score(scores)).toEqual(28);
// });
// test(‘when sibling scores equal 10 but are not in the same frame’, () => {
// let scores = [3, 3, 7, 2];
// expect(subject.score(scores)).toEqual(15);
// });
// test(‘and a strike precedes a false spare’, () => {
// let scores = [10, 3, 7, 5, 0];
// expect(subject.score(scores)).toEqual(40);
// });
// test(‘when a perfect game is bowled’, () => {
// let scores = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10];
// expect(subject.score(scores)).toEqual(300);
// });
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment