Skip to content

Commit

Permalink
remove end of questionnaire
Browse files Browse the repository at this point in the history
  • Loading branch information
shelleytruong committed Apr 8, 2022
1 parent 2f4f63d commit e78176d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 55 deletions.
27 changes: 4 additions & 23 deletions src/eq_schema/builders/routing2/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe("Routing2", () => {
],
},
destination: {
logical: "EndOfQuestionnaire",
logical: "EndOfCurrentSection",
},
},
],
Expand All @@ -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([
{
Expand All @@ -108,7 +89,7 @@ describe("Routing2", () => {
},
},
{
group: "confirmation-group",
section: "End",
when: {
and: [
{
Expand Down Expand Up @@ -171,7 +152,7 @@ describe("Routing2", () => {
],
},
destination: {
logical: "EndOfQuestionnaire",
logical: "EndOfCurrentSection",
},
},
],
Expand Down Expand Up @@ -204,7 +185,7 @@ describe("Routing2", () => {
},
},
{
group: "confirmation-group",
section: "End",
when: {
or: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,14 @@ 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",
};
} else if (logical === "NextPage") {
return getNextPageDestination(pageId, ctx);
}

if (logical === "EndOfCurrentSection") {
return { section: "End" };
}

throw new Error(`${logical} is not a valid destination type`);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {};

Expand Down
4 changes: 2 additions & 2 deletions src/eq_schema/schema/Group/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ describe("Group", () => {
else: {
section: null,
page: null,
logical: "EndOfQuestionnaire",
logical: "EndOfCurrentSection",
},
};

Expand Down Expand Up @@ -419,7 +419,7 @@ describe("Group", () => {
},
},
{
group: "confirmation-group",
section: "End",
},
];

Expand Down

0 comments on commit e78176d

Please sign in to comment.