UNPKG

@instructure/quiz-interactions

Version:

A React UI component Library for quiz interaction types.

49 lines (41 loc) 1.5 kB
import TrueFalseInteractionType from '../true_false' import checkUserResponseTransform from '../../__tests__/sharedRecordTests' describe('TrueFalseInteractionType', () => { const IntTypeRecord = TrueFalseInteractionType const intType = new IntTypeRecord() describe('#getDefaultInteractionData', () => { it('returns true and false choices when slug is "true-false" ', () => { const intData = intType.getDefaultInteractionData() expect(intData.trueChoice).toBe('True') expect(intData.falseChoice).toContain('False') }) }) describe('#getDefaultScoringData', () => { it('returns scoringData value as true when slug is "true-false" ', () => { const scoringData = intType.getDefaultScoringData() expect(scoringData.value).toBe(true) }) }) describe('#hasResponse', () => { it('returns true when there is a response', () => { const resp = false expect(intType.hasResponse(resp)).toBe(true) }) it('returns false when there is no response', () => { const resp = null expect(intType.hasResponse(resp)).toBe(false) }) }) const interactionData = { trueChoice: 'True', falseChoice: 'False', } const validResponse = true const invalidResponse = void 0 checkUserResponseTransform( new TrueFalseInteractionType(), {response: validResponse, interactionData, expected: 'True'}, {response: invalidResponse, interactionData, expected: 'False'}, out => out.props.children, ) })