Skip to content

Instantly share code, notes, and snippets.

@Cst2989
Created October 22, 2021 09:57
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/2133174ad0181f0feeae0749381d63dd to your computer and use it in GitHub Desktop.
Save Cst2989/2133174ad0181f0feeae0749381d63dd to your computer and use it in GitHub Desktop.
calculateFrame testing
describe('calculateFrame function', () => {
test('it should return error message for non-zero number after strike', () => {
const firstRoll = 10; // strike
const secondRoll = 1; // invalid input
const frameScore = calculateFrame(firstRoll, secondRoll);
expect(frameScore).toBe('Invalid frame input');
});
test('it should return error message sum in frame is bigger than 10', () => {
const firstRoll = 7;
const secondRoll = 5; // invalid input
const frameScore = calculateFrame(firstRoll, secondRoll);
expect(frameScore).toBe('Invalid frame input');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment