chore: finish frontend ESLint migration #18
Enable every plugin recommended preset and replace Biome with ESLint formatting. Preserve API contracts and JSX whitespace; verify source, tests, builds and tooling.
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import type { FC } from "react";
|
||||
|
||||
import { QueryClientProvider } from "@tanstack/react-query";
|
||||
import {
|
||||
act,
|
||||
@@ -6,24 +8,25 @@ import {
|
||||
screen,
|
||||
waitFor,
|
||||
} from "@testing-library/react";
|
||||
import { HttpResponse, http } from "msw";
|
||||
import type { FC } from "react";
|
||||
import { http, HttpResponse } from "msw";
|
||||
import { MemoryRouter, useNavigate } from "react-router";
|
||||
import { beforeEach, describe, expect, it } from "vitest";
|
||||
|
||||
import { AuthProvider } from "@/features/auth";
|
||||
import { createTestQueryClient } from "@/test/query";
|
||||
import { resource } from "@/test/resource";
|
||||
import { server } from "@/test/server";
|
||||
|
||||
import { ProtectedDocumentTitle } from "./DocumentTitle";
|
||||
|
||||
const Navigation: FC = () => {
|
||||
const navigate = useNavigate();
|
||||
return (
|
||||
<>
|
||||
<button type="button" onClick={() => navigate("/accounts/all/income")}>
|
||||
<button onClick={() => navigate("/accounts/all/income")} type="button">
|
||||
Все счета
|
||||
</button>
|
||||
<button type="button" onClick={() => navigate(-1)}>
|
||||
<button onClick={() => navigate(-1)} type="button">
|
||||
Назад
|
||||
</button>
|
||||
</>
|
||||
@@ -48,7 +51,7 @@ beforeEach(() => {
|
||||
http.post("*/api/v1/auth/refresh", () =>
|
||||
HttpResponse.json({
|
||||
accessToken: "test-token",
|
||||
user: { id: "user-1", email: "user@example.com" },
|
||||
user: { email: "user@example.com", id: "user-1" },
|
||||
}),
|
||||
),
|
||||
);
|
||||
@@ -56,10 +59,7 @@ beforeEach(() => {
|
||||
|
||||
describe("document titles", () => {
|
||||
it("updates a loading account name and follows account scope and history", async () => {
|
||||
let resolveAccounts!: () => void;
|
||||
const accountsReady = new Promise<void>((resolve) => {
|
||||
resolveAccounts = resolve;
|
||||
});
|
||||
const { promise: accountsReady, resolve: resolveAccounts } = Promise.withResolvers<void>();
|
||||
server.use(
|
||||
http.get("*/api/v1/brokerage-accounts", async () => {
|
||||
await accountsReady;
|
||||
@@ -68,7 +68,7 @@ describe("document titles", () => {
|
||||
);
|
||||
renderTitle("/accounts/a/income?from=2026-01-01&to=2026-08-31");
|
||||
expect(document.title).toBe("Пассивный доход — Счет — WealthLedger");
|
||||
await act(async () => resolveAccounts());
|
||||
await act(() => Promise.resolve(resolveAccounts()));
|
||||
await waitFor(() =>
|
||||
expect(document.title).toBe("Пассивный доход — ИИС — WealthLedger"),
|
||||
);
|
||||
@@ -98,15 +98,15 @@ describe("document titles", () => {
|
||||
);
|
||||
|
||||
it("keeps a useful title when the instrument is unavailable", async () => {
|
||||
let requested = false;
|
||||
let isRequested = false;
|
||||
server.use(
|
||||
http.get("*/api/v1/stocks/by-ticker/:ticker", () => {
|
||||
requested = true;
|
||||
isRequested = true;
|
||||
return HttpResponse.json({ code: "NOT_FOUND" }, { status: 404 });
|
||||
}),
|
||||
);
|
||||
renderTitle("/stocks/missing");
|
||||
await waitFor(() => expect(requested).toBe(true));
|
||||
await waitFor(() => expect(isRequested).toBe(true));
|
||||
expect(document.title).toBe("Акция — WealthLedger");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user