From e78176d385294064fa3e855732ce08178b422b19 Mon Sep 17 00:00:00 2001 From: shelleytruong Date: Fri, 8 Apr 2022 11:17:46 +0100 Subject: [PATCH 1/2] remove end of questionnaire --- src/eq_schema/builders/routing2/index.test.js | 27 +++---------------- .../translateRoutingDestination/index.js | 11 +------- .../translateRoutingDestination/index.test.js | 20 -------------- src/eq_schema/schema/Group/index.test.js | 4 +-- 4 files changed, 7 insertions(+), 55 deletions(-) diff --git a/src/eq_schema/builders/routing2/index.test.js b/src/eq_schema/builders/routing2/index.test.js index aec64bcb..b5e7c9aa 100644 --- a/src/eq_schema/builders/routing2/index.test.js +++ b/src/eq_schema/builders/routing2/index.test.js @@ -54,7 +54,7 @@ describe("Routing2", () => { ], }, destination: { - logical: "EndOfQuestionnaire", + logical: "EndOfCurrentSection", }, }, ], @@ -70,25 +70,6 @@ describe("Routing2", () => { "routing", ctx ); - expect(ctx.routingGotos).toMatchObject([ - { - group: "confirmation-group", - groupId: "group1", - when: { - and: [ - { - "any-in": [ - ["red", "white"], - { - identifier: "answer2", - source: "answers", - }, - ], - }, - ], - }, - }, - ]); expect(runnerRouting).toMatchObject([ { @@ -108,7 +89,7 @@ describe("Routing2", () => { }, }, { - group: "confirmation-group", + section: "End", when: { and: [ { @@ -171,7 +152,7 @@ describe("Routing2", () => { ], }, destination: { - logical: "EndOfQuestionnaire", + logical: "EndOfCurrentSection", }, }, ], @@ -204,7 +185,7 @@ describe("Routing2", () => { }, }, { - group: "confirmation-group", + section: "End", when: { or: [ { diff --git a/src/eq_schema/builders/routing2/translateRoutingDestination/index.js b/src/eq_schema/builders/routing2/translateRoutingDestination/index.js index 0a34bc01..2050ebdf 100644 --- a/src/eq_schema/builders/routing2/translateRoutingDestination/index.js +++ b/src/eq_schema/builders/routing2/translateRoutingDestination/index.js @@ -48,13 +48,7 @@ const getNextPageDestination = (pageId, ctx) => { }; const getLogicalDestination = (pageId, { logical }, ctx) => { - if (logical === "EndOfQuestionnaire") { - return { - group: get(ctx.questionnaireJson, "summary") - ? "summary-group" - : "confirmation-group", - }; - } else if (logical === "EndOfCurrentSection") { + if (logical === "EndOfCurrentSection") { return { section: "End", }; @@ -62,9 +56,6 @@ const getLogicalDestination = (pageId, { logical }, ctx) => { return getNextPageDestination(pageId, ctx); } - if (logical === "EndOfCurrentSection") { - return { section: "End" }; - } throw new Error(`${logical} is not a valid destination type`); }; diff --git a/src/eq_schema/builders/routing2/translateRoutingDestination/index.test.js b/src/eq_schema/builders/routing2/translateRoutingDestination/index.test.js index 85dfa4cf..aff7aee0 100644 --- a/src/eq_schema/builders/routing2/translateRoutingDestination/index.test.js +++ b/src/eq_schema/builders/routing2/translateRoutingDestination/index.test.js @@ -61,26 +61,6 @@ describe("Translation of a routing destination", () => { ).toMatchObject({ group: "summary-group" }); }); - it("should translate a end of questionnaire destination as summary", () => { - const authorDestination = { - logical: "EndOfQuestionnaire", - }; - expect( - translateRoutingDestination(authorDestination, "3", { - questionnaireJson: questionnaireJsonWithSummary, - }) - ).toMatchObject({ group: "summary-group" }); - }); - - it("should translate a end of questionnaire destination as confirmation-group", () => { - const authorDestination = { - logical: "EndOfQuestionnaire", - }; - expect( - translateRoutingDestination(authorDestination, "1", { questionnaireJson }) - ).toMatchObject({ group: "confirmation-group" }); - }); - it("should fail if not provided any destinations", () => { const authorDestination = {}; diff --git a/src/eq_schema/schema/Group/index.test.js b/src/eq_schema/schema/Group/index.test.js index 9f6cac18..002046f0 100644 --- a/src/eq_schema/schema/Group/index.test.js +++ b/src/eq_schema/schema/Group/index.test.js @@ -377,7 +377,7 @@ describe("Group", () => { else: { section: null, page: null, - logical: "EndOfQuestionnaire", + logical: "EndOfCurrentSection", }, }; @@ -419,7 +419,7 @@ describe("Group", () => { }, }, { - group: "confirmation-group", + section: "End", }, ]; From 10aa2bb0ef5b05ada9a5938141077d860f18f328 Mon Sep 17 00:00:00 2001 From: shelleytruong Date: Fri, 8 Apr 2022 11:19:04 +0100 Subject: [PATCH 2/2] space --- .../builders/routing2/translateRoutingDestination/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/eq_schema/builders/routing2/translateRoutingDestination/index.js b/src/eq_schema/builders/routing2/translateRoutingDestination/index.js index 2050ebdf..99c181b1 100644 --- a/src/eq_schema/builders/routing2/translateRoutingDestination/index.js +++ b/src/eq_schema/builders/routing2/translateRoutingDestination/index.js @@ -48,7 +48,7 @@ const getNextPageDestination = (pageId, ctx) => { }; const getLogicalDestination = (pageId, { logical }, ctx) => { - if (logical === "EndOfCurrentSection") { + if (logical === "EndOfCurrentSection") { return { section: "End", };