-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #682 from patrickhanl/issue663
Make you are here points on marginal tax rate charts a point instead of a line
- Loading branch information
Showing
2 changed files
with
114 additions
and
26 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 |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import { render, screen } from "@testing-library/react"; | ||
import MarginalTaxRates from "pages/household/output/MarginalTaxRates"; | ||
import { useSearchParams } from "react-router-dom"; | ||
|
||
jest.mock("react-plotly.js", () => jest.fn()); | ||
jest.mock("../api/variables.js", () => ({ | ||
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 householdInput = { | ||
people: { | ||
you: { | ||
employment_income: { | ||
2023: {}, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
const metadata = { | ||
countryId: "us", | ||
}; | ||
|
||
const policy = { | ||
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(); | ||
}); | ||
}); | ||
|
||
//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