Skip to content

Instantly share code, notes, and snippets.

@Cst2989
Created October 22, 2021 10:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Cst2989/72883982bbe94adc7f085b09c288f534 to your computer and use it in GitHub Desktop.
Save Cst2989/72883982bbe94adc7f085b09c288f534 to your computer and use it in GitHub Desktop.
total score test
describe('totalScore function', () => {
test('it should return total score when no spares/strike', () => {
const scoreCard = '2222222222'
const totalScore = totalScore(scoreCard);
expect(totalScore).toBe(20);
});
test('it should return total score when we have spares', () => {
const scoreCard = '/2222222/2'
const totalScore = totalScore(scoreCard);
expect(totalScore).toBe(38);
});
test('it should return total score when we have spares and strike', () => {
const scoreCard = '/2X22222/2'
const totalScore = totalScore(scoreCard);
expect(totalScore).toBe(48);
});
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment