-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
resolve merge conflicts & update formatting
- Loading branch information
1 parent
d961a59
commit ce70d8a
Showing
2 changed files
with
37 additions
and
42 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,62 @@ | ||
import { fireEvent, render, screen, within } from "@testing-library/react"; | ||
import { render, screen} from "@testing-library/react"; | ||
import MarginalTaxRates from "pages/household/output/MarginalTaxRates"; | ||
import { | ||
getPlotlyAxisFormat, | ||
getValueFromHousehold, | ||
} from "api/variables.js"; | ||
import { useSearchParams } from "react-router-dom"; | ||
|
||
|
||
jest.mock("react-plotly.js", () => jest.fn()); | ||
jest.mock("../api/variables.js", () => ({ | ||
getValueFromHousehold: jest.fn(), | ||
getPlotlyAxisFormat: jest.fn() | ||
getValueFromHousehold: jest.fn(), | ||
getPlotlyAxisFormat: jest.fn() | ||
})); | ||
jest.mock("react-router-dom", () => { | ||
const originalModule = jest.requireActual("react-router-dom"); | ||
return { | ||
__esModule: true, | ||
...originalModule, | ||
useSearchParams: jest.fn() | ||
} | ||
const originalModule = jest.requireActual("react-router-dom"); | ||
return { | ||
__esModule: true, | ||
...originalModule, | ||
useSearchParams: jest.fn() | ||
} | ||
}); | ||
|
||
const householdInput = {people: { | ||
you: { | ||
employment_income: { | ||
"2023": {} | ||
} | ||
you: { | ||
employment_income: { | ||
"2023": {} | ||
} | ||
} | ||
}}; | ||
|
||
const metadata = { | ||
countryId: "us" | ||
countryId: "us" | ||
} | ||
|
||
const policy = { | ||
baseline: { | ||
data: {} | ||
}, | ||
reform: { | ||
data: {} | ||
} | ||
baseline: { | ||
data: {} | ||
}, | ||
reform: { | ||
data: {} | ||
} | ||
} | ||
|
||
describe("Test Render Output", () => { | ||
test("Should render description", () => { | ||
useSearchParams.mockImplementation(() => { | ||
const get = (param) => { | ||
if (param === "focus") { | ||
return "householdOutput.mtr" | ||
} else if (param === "reform") { | ||
return "13870" | ||
} else if (param === "baseline") { | ||
return "13867" | ||
} else if (param === "household") { | ||
return "33253" | ||
} | ||
} | ||
return [{get}]; | ||
}); | ||
render(<MarginalTaxRates householdInput={householdInput} metadata={metadata} policy={policy}/>); | ||
expect(screen.getByText("This chart shows how your net income changes under different earnings. It is based on your household's current situation.")).toBeTruthy(); | ||
test("Should render description", () => { | ||
useSearchParams.mockImplementation(() => { | ||
const get = (param) => { | ||
if (param === "focus") { | ||
return "householdOutput.mtr" | ||
} else if (param === "reform") { | ||
return "13870" | ||
} else if (param === "baseline") { | ||
return "13867" | ||
} else if (param === "household") { | ||
return "33253" | ||
} | ||
} | ||
return [{get}]; | ||
}); | ||
render(<MarginalTaxRates householdInput={householdInput} metadata={metadata} policy={policy}/>); | ||
expect(screen.getByText("This chart shows how your net income changes under different earnings. It is based on your household's current situation.")).toBeTruthy(); | ||
}); | ||
}); | ||
|
||
//TODO: Either render plots here or in own test files for validation |
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