Skip to content

Commit

Permalink
bugfix: display WP topic on the export page
Browse files Browse the repository at this point in the history
  • Loading branch information
jessabean committed Dec 19, 2024
1 parent ad27cf3 commit c982db1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
} from "utils/testing/setupJest";
import {
mockSARReportWithOverlays,
mockWPReportWithOtherTypeOverlays,
mockWPReportWithOverlays,
} from "utils/testing/mockReport";
import {
Expand Down Expand Up @@ -336,9 +335,10 @@ describe("<ExportedModalOverlayReportSection />", () => {
test("should render correct initiative topic", () => {
mockedUseStore.mockReturnValue({
...mockReportStore,
report: mockWPReportWithOtherTypeOverlays,
report: mockWPReportWithOverlays,
});
render(testComponent(wpMockProps));
expect(screen.getByText("mock WP topic")).toBeInTheDocument();
expect(screen.getByText("Unique initiative type")).toBeInTheDocument();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,9 @@ export function renderModalOverlayTableBody(
{`${idx + 1}. ${entity.initiative_name}` ?? "Not entered"}
</Heading>
<Text sx={sx.headingSubtitle}>
{entity.initiative_wp_otherTopic ??
entity.initiative_wpTopic[0].value}
{entity.initiative_wp_otherTopic
? entity.initiative_wp_otherTopic
: entity.initiative_wpTopic[0].value}
</Text>
</Box>
</Flex>
Expand Down
33 changes: 12 additions & 21 deletions services/ui-src/src/utils/testing/mockReport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,18 @@ export const mockWPReportWithOverlays = {
},
],
},
{
...mockWPFullReport.fieldData.entityType[0],
type: OverlayModalTypes.INITIATIVE,
id: "mock wip id",
initiative_wpTopic: [
{
key: "other-type-key",
value: "Other, specify",
},
],
initiative_wp_otherTopic: "Unique initiative type",
},
],
},
formTemplate: {
Expand All @@ -520,27 +532,6 @@ export const mockWPReportWithOverlays = {
},
};

export const mockWPReportWithOtherTypeOverlays = {
...mockWPFullReport,
fieldData: {
...mockWPFullReport.fieldData,
[OverlayModalTypes.INITIATIVE]: [
{
...mockWPFullReport.fieldData.entityType[0],
type: OverlayModalTypes.INITIATIVE,
id: "mock wip id",
initiative_wpTopic: [
{
key: "other-type-key",
value: "Other, specify",
},
],
initiative_wp_otherTopic: "Unique initiative type",
},
],
},
};

export const mockSARReportWithOverlays = {
...mockSARFullReport,
fieldData: {
Expand Down

0 comments on commit c982db1

Please sign in to comment.