Skip to content

Commit cdd97df

Browse files
committed
fixing logic issue
1 parent 28a8785 commit cdd97df

2 files changed

Lines changed: 34 additions & 1 deletion

File tree

sites/partners/__tests__/components/listings/PaperListingForm/sections/RankingsAndResults.test.tsx

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,4 +131,35 @@ describe("RankingsAndResults", () => {
131131
expect(screen.getByRole("radio", { name: /First come first serve/i })).toBeInTheDocument()
132132
expect(screen.getByRole("radio", { name: "Lottery" })).toBeInTheDocument()
133133
})
134+
135+
it("should show review order options when availabilityQuestion is availableUnits and enableWaitlistLottery is false", () => {
136+
document.cookie = "access-token-available=True"
137+
server.use(
138+
rest.get("http://localhost/api/adapter/user", (_req, res, ctx) => {
139+
return res(ctx.json(adminUserWithoutWaitlistLotteryFlag))
140+
})
141+
)
142+
143+
render(
144+
<FormComponent
145+
values={{
146+
...formDefaults,
147+
jurisdictions: { id: "jurisdiction1" },
148+
listingAvailabilityQuestion: "availableUnits",
149+
}}
150+
>
151+
<RankingsAndResults
152+
requiredFields={[]}
153+
whatToExpectEditor={null}
154+
whatToExpectAdditionalTextEditor={null}
155+
/>
156+
</FormComponent>
157+
)
158+
159+
screen.getByRole("heading", { name: "Rankings & results" })
160+
expect(screen.getByText("How is the application review order determined?")).toBeInTheDocument()
161+
162+
expect(screen.getByRole("radio", { name: /First come first serve/i })).toBeInTheDocument()
163+
expect(screen.getByRole("radio", { name: "Lottery" })).toBeInTheDocument()
164+
})
134165
})

sites/partners/src/components/listings/PaperListingForm/sections/RankingsAndResults.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,9 @@ const RankingsAndResults = ({
9191
selectedJurisdictionId
9292
)
9393

94-
const showFSFCLotterySection = enableWaitlistLottery && waitlistOpen
94+
const showFSFCLotterySection =
95+
(enableWaitlistLottery && waitlistOpen) ||
96+
(availabilityQuestion !== "openWaitlist" && !enableWaitlistLottery)
9597

9698
// Ensure the lottery fields only show when it's "available units" listing
9799
const showLotteryFields =

0 commit comments

Comments
 (0)