Skip to content

Commit

Permalink
Test for builder without specifying correct choice
Browse files Browse the repository at this point in the history
  • Loading branch information
leung018 committed Oct 27, 2023
1 parent dd0d04b commit 0087ef2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/model/mc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ describe('MultipleChoice', () => {
expect(() => {
presetIndexBuilder.setCorrectChoiceIndex(-1).build()
}).toThrowCustomError(MultipleChoiceError, 'INVALID_INDEX')

// using builder without setting correctChoiceIndex should throw
expect(() => {
new MultipleChoiceBuilder()
.addFixedChoice('a')
.addFixedChoice('b')
.build()
}).toThrowCustomError(MultipleChoiceError, 'INVALID_INDEX')
})

it('should reject duplicate answers', () => {
Expand Down

0 comments on commit 0087ef2

Please sign in to comment.