-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Minor content changes for 2023 (#139480)
- Loading branch information
1 parent
5c21cb3
commit caa5805
Showing
4 changed files
with
80 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import React from "react"; | ||
import { Provider } from "react-redux"; | ||
import configureMockStore from "redux-mock-store"; | ||
import Repeatables from "./Repeatables"; | ||
import { screen, render } from "@testing-library/react"; | ||
|
||
const mockStore = configureMockStore(); | ||
const store = mockStore({ lastYearTotals: { 2022: [] } }); | ||
const renderQuestion = async (question) => | ||
await render( | ||
<Provider store={store}> | ||
<Repeatables | ||
question={question} | ||
type={null} | ||
disabled={false} | ||
addRepeatableTo={jest.fn()} | ||
removeRepeatableFrom={jest.fn()} | ||
></Repeatables> | ||
</Provider> | ||
); | ||
|
||
describe("Repeatables", () => { | ||
it("should render with default verbiage", async () => { | ||
const question = { | ||
typeLabel: "TypeLabel", | ||
questions: [], | ||
}; | ||
await renderQuestion(question); | ||
screen.getByText("Do you have another TypeLabel in this list?"); | ||
screen.getByText("Optional"); | ||
screen.getByText("Add another TypeLabel"); | ||
}); | ||
|
||
it("should hide the Optional hint when specified", async () => { | ||
const question = { | ||
hideOptionalHint: true, | ||
questions: [], | ||
}; | ||
await renderQuestion(question); | ||
expect(screen.queryByText("Optional")).toBeNull(); | ||
}); | ||
|
||
it("should use override verbiage when specified", async () => { | ||
const question = { | ||
addAnotherText: "Y'all got more or what?", | ||
questions: [], | ||
}; | ||
await renderQuestion(question); | ||
expect(screen.queryByText(/Do you have another/)).toBeNull(); | ||
screen.getByText("Y'all got more or what?"); | ||
}); | ||
}); |