refactor: simplify errors and focus tests
This commit is contained in:
@@ -210,23 +210,9 @@ describe("useAccountPageViewModel", () => {
|
||||
expect(snapshot).toEqual(original);
|
||||
});
|
||||
|
||||
it("prepares grouped position sections with derived display data", async () => {
|
||||
configureTestAuth();
|
||||
mockLoadedAccountPage();
|
||||
|
||||
const { result } = renderHook(() => useAccountPageViewModel(), {
|
||||
wrapper: createWrapper(),
|
||||
});
|
||||
|
||||
await waitFor(() => expect(result.current.state).toBe("loaded"));
|
||||
|
||||
const loaded = result.current as Extract<
|
||||
typeof result.current,
|
||||
{ state: "loaded" }
|
||||
>;
|
||||
|
||||
it("prepares grouped position sections with derived display data", () => {
|
||||
expect(
|
||||
loaded.positionSections.map(({ groups, kind }) => ({
|
||||
toAccountPagePositionSections(portfolio).map(({ groups, kind }) => ({
|
||||
kind,
|
||||
positions: groups.flatMap(group => group.positions),
|
||||
})),
|
||||
|
||||
@@ -5,7 +5,7 @@ import { describe, expect, it } from "vitest";
|
||||
import { CurrencyCards } from "./CurrencyCards.view";
|
||||
|
||||
describe("CurrencyCards currency presentation", () => {
|
||||
it.each([0, 1, 3, 5])(
|
||||
it.each([0, 5])(
|
||||
"renders only the %i supplied totals in upstream order",
|
||||
(count) => {
|
||||
const totals = [
|
||||
@@ -74,20 +74,4 @@ describe("CurrencyCards currency presentation", () => {
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
it("keeps USD and CAD as distinct supplied values", () => {
|
||||
render(
|
||||
<MantineProvider>
|
||||
<CurrencyCards
|
||||
amounts={[
|
||||
{ currency: "USD", value: "1.00" },
|
||||
{ currency: "CAD", value: "2.00" },
|
||||
]}
|
||||
/>
|
||||
</MantineProvider>,
|
||||
);
|
||||
expect(
|
||||
screen.getAllByRole("definition").map(node => node.textContent),
|
||||
).toEqual(["1,00 $", "2,00 CAD"]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user