diff --git a/spec/src/modules/quizzes.js b/spec/src/modules/quizzes.js index 7e1c0c00..6ccd1201 100644 --- a/spec/src/modules/quizzes.js +++ b/spec/src/modules/quizzes.js @@ -62,7 +62,7 @@ describe(`ConstructorIO - Quizzes${bundledDescriptionSuffix}`, () => { expect(res).to.have.property('quiz_version_id').to.be.an('string'); expect(res).to.have.property('questions').to.be.an('array'); expect(res.questions[0].id).to.equal(1); - expect(res.total_questions).to.equal(1); + expect(res.total_questions).to.equal(4); expect(fetchSpy).to.have.been.called; expect(requestedUrlParams).to.have.property('key'); expect(requestedUrlParams).to.have.property('i'); @@ -103,7 +103,7 @@ describe(`ConstructorIO - Quizzes${bundledDescriptionSuffix}`, () => { expect(res).to.have.property('questions').to.be.an('array'); expect(res).to.have.property('quiz_version_id').to.be.an('string').to.equal(quizVersionId); - expect(res.total_questions).to.equal(1); + expect(res.total_questions).to.equal(4); expect(fetchSpy).to.have.been.called; expect(requestedUrlParams).to.have.property('quiz_version_id').to.equal(quizVersionId); }); @@ -145,6 +145,18 @@ describe(`ConstructorIO - Quizzes${bundledDescriptionSuffix}`, () => { return expect(quizzes.getQuizAllQuestions(validQuizId, { quizVersionId: 'foo' })).to.eventually.be.rejected; }); + + it('Should return 400 when quiz has jump logic', () => { + const { quizzes } = new ConstructorIO({ + apiKey: quizApiKey, + fetch: fetchSpy, + }); + + return expect(quizzes.getQuizAllQuestions('test-quiz-2')).to.eventually.be.rejected.then((err) => { + expect(err.status).to.equal(400); + expect(err.message).to.equal('The requested quiz does not support question retrieval.'); + }); + }); }); describe('getQuizNextQuestion', () => { diff --git a/src/types/tests/quizzes.test-d.ts b/src/types/tests/quizzes.test-d.ts index 975b3fc1..6a9af0c2 100644 --- a/src/types/tests/quizzes.test-d.ts +++ b/src/types/tests/quizzes.test-d.ts @@ -8,6 +8,7 @@ expectAssignable({ description: 'Sample description', type: 'multiple', cta_text: 'Next', + is_skippable: false, images: { primary_url: 'https://example.com/image', primary_alt: 'Example image', @@ -44,6 +45,7 @@ expectAssignable({ id: 1, title: 'Sample open text question', description: 'Sample description', + is_skippable: false, type: 'open', cta_text: 'Next', images: { @@ -299,4 +301,5 @@ expectAssignable({ }, quiz_version_id: '6bfaa6d5-7272-466b-acd9-4bcf322a2f1e', quiz_id: 'test-quiz', + metadata: null, });