Skip to content

Commit

Permalink
feat: required stepId
Browse files Browse the repository at this point in the history
  • Loading branch information
chohner committed Jan 10, 2025
1 parent 9546f3d commit c810cc6
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/services/cms/models/StrapiFormFlowPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { StrapiFormComponentSchema } from "./StrapiFormComponent";
export const StrapiFormFlowPageSchema = z
.object({
heading: z.string(),
stepId: z.string().nullable(),
stepId: z.string(),
flow_ids: z.array(StrapiFlowIdSchema),
preHeading: z.string().nullable(),
nextButtonLabel: z.string().nullable(),
Expand Down
2 changes: 1 addition & 1 deletion app/services/cms/models/StrapiResultPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { StrapiResultPageTypeSchema } from "./StrapiResultPageType";

export const StrapiResultPageSchema = z
.object({
stepId: z.string().nullable(),
stepId: z.string(),
flow_ids: z.array(StrapiFlowIdSchema),
pageType: StrapiResultPageTypeSchema,
heading: StrapiHeadingSchema,
Expand Down
2 changes: 1 addition & 1 deletion app/services/cms/models/StrapiVorabCheckPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { StrapiFormComponentSchema } from "./StrapiFormComponent";

export const StrapiVorabCheckPageSchema = z
.object({
stepId: z.string().nullable(),
stepId: z.string(),
flow_ids: z.array(StrapiFlowIdSchema),
pre_form: z.array(StrapiContentComponentSchema),
form: z.array(StrapiFormComponentSchema),
Expand Down
2 changes: 1 addition & 1 deletion app/services/flowNavigation.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export function navItemsFromStepStates(

return {
destination: stepState.url,
label: translations[stepState.stepId ?? ""] ?? stepState.stepId,
label: translations[stepState.stepId] ?? stepState.stepId,
subflows: subNavItems,
state: navState({ isCurrent, isDone, isReachable }),
};
Expand Down
7 changes: 4 additions & 3 deletions tests/factories/cmsModels/strapiFlowPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@ import { type StrapiFormComponent } from "~/services/cms/models/StrapiFormCompon
import { type StrapiFormFlowPage } from "~/services/cms/models/StrapiFormFlowPage";

export function getStrapiFlowPage(
params: Partial<Pick<StrapiFormFlowPage, "stepId" | "form" | "locale">>,
params: Pick<StrapiFormFlowPage, "stepId" | "form"> &
Partial<Pick<StrapiFormFlowPage, "locale">>,
): StrapiFormFlowPage {
return {
heading: faker.lorem.words(5),
preHeading: faker.lorem.words(5),
nextButtonLabel: null,
backButtonLabel: null,
form: params.form ?? [],
stepId: params.stepId ?? faker.lorem.word(),
form: params.form,
stepId: params.stepId,
flow_ids: [{ flowId: "/beratungshilfe/antrag" }],
pre_form: [],
post_form: [],
Expand Down

0 comments on commit c810cc6

Please sign in to comment.