refactor: enforce frontend view model boundaries
This commit is contained in:
@@ -37,7 +37,8 @@ function renderPage() {
|
||||
describe("AccountEventsPage", () => {
|
||||
beforeEach(() => {
|
||||
refresh.mockClear();
|
||||
query.mockReturnValue((/* eslint-disable unicorn/no-null -- Fixture preserves the production contract’s explicit null values. */
|
||||
/* eslint-disable unicorn/no-null -- Fixture preserves the production contract’s explicit null values. */
|
||||
query.mockReturnValue(
|
||||
{
|
||||
data: {
|
||||
accountId: "account",
|
||||
@@ -51,8 +52,8 @@ describe("AccountEventsPage", () => {
|
||||
sync: { errorCode: null, id: null, state: "idle" },
|
||||
},
|
||||
refetch: vi.fn(),
|
||||
}
|
||||
/* eslint-enable unicorn/no-null */) as never);
|
||||
} as /* eslint-enable unicorn/no-null */ never,
|
||||
);
|
||||
});
|
||||
|
||||
it("passes the selected route account to the query", () => {
|
||||
@@ -72,7 +73,8 @@ describe("AccountEventsPage", () => {
|
||||
});
|
||||
|
||||
it("keeps the loading fallback when no result or account is available", () => {
|
||||
query.mockReturnValue((/* eslint-disable unicorn/no-null -- Fixture preserves the production contract’s explicit null values. */
|
||||
/* eslint-disable unicorn/no-null -- Fixture preserves the production contract’s explicit null values. */
|
||||
query.mockReturnValue(
|
||||
{
|
||||
data: undefined,
|
||||
isError: false,
|
||||
@@ -82,8 +84,8 @@ describe("AccountEventsPage", () => {
|
||||
sync: { errorCode: null, id: null, state: "idle" },
|
||||
},
|
||||
refetch: vi.fn(),
|
||||
}
|
||||
/* eslint-enable unicorn/no-null */) as never);
|
||||
} as /* eslint-enable unicorn/no-null */ never,
|
||||
);
|
||||
renderPage();
|
||||
expect(query).toHaveBeenCalledWith("", {});
|
||||
expect(screen.getByRole("status", { name: "Загрузка" })).toHaveAttribute(
|
||||
@@ -93,7 +95,8 @@ describe("AccountEventsPage", () => {
|
||||
});
|
||||
|
||||
it("renders events and marks an offer without an amount", () => {
|
||||
query.mockReturnValue((/* eslint-disable unicorn/no-null -- Fixture preserves the production contract’s explicit null values. */
|
||||
/* eslint-disable unicorn/no-null -- Fixture preserves the production contract’s explicit null values. */
|
||||
query.mockReturnValue(
|
||||
{
|
||||
data: {
|
||||
accountId: "account",
|
||||
@@ -132,8 +135,8 @@ describe("AccountEventsPage", () => {
|
||||
sync: { errorCode: null, id: null, state: "idle" },
|
||||
},
|
||||
refetch: vi.fn(),
|
||||
}
|
||||
/* eslint-enable unicorn/no-null */) as never);
|
||||
} as /* eslint-enable unicorn/no-null */ never,
|
||||
);
|
||||
renderPage();
|
||||
expect(screen.getByText("1 250 ₽")).toBeInTheDocument();
|
||||
expect(screen.getByText("Сумма неизвестна")).toBeInTheDocument();
|
||||
@@ -180,7 +183,8 @@ describe("AccountEventsPage", () => {
|
||||
});
|
||||
|
||||
it("shows a structural busy state before events are available", () => {
|
||||
query.mockReturnValue((/* eslint-disable unicorn/no-null -- Fixture preserves the production contract’s explicit null values. */
|
||||
/* eslint-disable unicorn/no-null -- Fixture preserves the production contract’s explicit null values. */
|
||||
query.mockReturnValue(
|
||||
{
|
||||
data: undefined,
|
||||
isError: false,
|
||||
@@ -190,8 +194,8 @@ describe("AccountEventsPage", () => {
|
||||
sync: { errorCode: null, id: null, state: "idle" },
|
||||
},
|
||||
refetch: vi.fn(),
|
||||
}
|
||||
/* eslint-enable unicorn/no-null */) as never);
|
||||
} as /* eslint-enable unicorn/no-null */ never,
|
||||
);
|
||||
|
||||
renderPage();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user