Typescript/Bowling.test.ts 2 Test errors

Bug report: bowling.test.ts

Your Typescript Bowling Exercise has an error in its testing. Someone forgot roll or somehow messed up.
I passed only 29 of the 31 tests. But the 2 tests I failed are below and are in error and should be fixed. Even the mentor aggreed with me. He saidHe took this test and passed it back then. So I imagine somehow the test.ts file must have been modified in error.

I used to be on a bowling for years. Simply do it manually without a computer. Place the rolls 1 line per fram and you will see the mistake.

it(two bonus rolls after a strike in the last frame cannot score more than 10 points
const rolls = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 5],
expect Error(Pin count exceeds pins on the lane)

Actually the error should be game not over, score not kown… etc. Most likely you are missing a roll for the test…


it(the second bonus rolls after a strike in the last frame cannot be a strike if the first one is not a strike
const rolls = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 6,]
EExpects: Error’Pin count exceeds pins on the lane)
Same as above missing a roll, so game not over score message should be returned.

You might be misreading the tests. Assuming I’m looking at the same tests as you, those rolls are the setup. Those tests have one more roll, which is what the tests are actually testing.

    xit('bonus roll after a strike in the last frame cannot score more than 10 points', () => {
      const rolls = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10]
      const bowling = new Bowling()
      rolls.forEach((roll) => {
        bowling.roll(roll)
      })
      expect(() => {
        bowling.roll(11)
      }).toThrow(new Error('Pin count exceeds pins on the lane'))
    })

    xit('two bonus rolls after a strike in the last frame cannot score more than 10 points', () => {
      const rolls = [
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 5,
      ]
      const bowling = new Bowling()
      rolls.forEach((roll) => {
        bowling.roll(roll)
      })
      expect(() => {
        bowling.roll(6)
      }).toThrow(new Error('Pin count exceeds pins on the lane'))
    })

Perhaps you are right. I am new to Jest.
I noticed you pointed out the expect(6) then throw error. pin. If that expect outside the loop is the additional roll then that may be why I was not understanding the test.

I will recheck my code and repull the exercise.

Thank You
For your prompt reply.

Yes. There are a bunch of rolls which are the “setup” then there is the actual roll which is being tested.