Frontend verify / commits (pull_request) Successful in 29s
Frontend verify / security (pull_request) Successful in 9s
Frontend verify / verify (pull_request) Successful in 8m54s
Frontend verify / commits (push) Skipped
Frontend verify / security (push) Successful in 12s
Frontend verify / verify (push) Successful in 9m59s
85 lines
2.1 KiB
TypeScript
85 lines
2.1 KiB
TypeScript
import { http, HttpResponse } from "msw";
|
|
|
|
import { resource } from "@/test/resource";
|
|
|
|
const authentication = {
|
|
accessToken: "test-token",
|
|
user: { email: "user@example.com", id: "user-1" },
|
|
};
|
|
|
|
const handlers = [
|
|
http.post("*/api/v1/auth/register", () => HttpResponse.json(authentication)),
|
|
http.post("*/api/v1/auth/login", () => HttpResponse.json(authentication)),
|
|
http.post("*/api/v1/auth/refresh", () =>
|
|
HttpResponse.json({ code: "UNAUTHORIZED" }, { status: 401 }),
|
|
),
|
|
http.post(
|
|
"*/api/v1/auth/logout",
|
|
() => new HttpResponse(null, { status: 204 }),
|
|
),
|
|
http.get("*/api/v1/auth/me", () => HttpResponse.json(authentication.user)),
|
|
http.get("*/api/v1/tbank-connection", () =>
|
|
|
|
HttpResponse.json(
|
|
{ connected: false, connectedAt: null },
|
|
),
|
|
),
|
|
http.put("*/api/v1/tbank-connection", () =>
|
|
HttpResponse.json({ connected: true, connectedAt: "2026-08-14T00:00:00Z" }),
|
|
),
|
|
http.delete(
|
|
"*/api/v1/tbank-connection",
|
|
() => new HttpResponse(null, { status: 204 }),
|
|
),
|
|
http.get("*/api/v1/brokerage-accounts", () =>
|
|
HttpResponse.json(resource([])),
|
|
),
|
|
http.get("*/api/v1/brokerage-accounts/:accountId/portfolio", () =>
|
|
HttpResponse.json(
|
|
resource({
|
|
cashBalances: [],
|
|
isStale: false,
|
|
lastSuccessfulAt: "2026-08-14T00:00:00Z",
|
|
positions: [],
|
|
structure: { currencies: [], unvaluedCategories: [] },
|
|
totalsByCurrency: [],
|
|
}),
|
|
),
|
|
),
|
|
http.get("*/api/v1/brokerage-accounts/:accountId/operations", () =>
|
|
HttpResponse.json(
|
|
|
|
resource(
|
|
{
|
|
accountId: "account-1",
|
|
hasNext: false,
|
|
items: [],
|
|
nextCursor: null,
|
|
observedAt: "2026-08-14T00:00:00Z",
|
|
},
|
|
),
|
|
),
|
|
),
|
|
http.get("*/api/v1/brokerage-accounts/:accountId/events", () =>
|
|
HttpResponse.json(
|
|
resource({
|
|
accountId: "account-1",
|
|
calculatedAt: "2026-08-14T00:00:00Z",
|
|
events: [],
|
|
}),
|
|
),
|
|
),
|
|
http.get("*/api/v1/brokerage-accounts/:accountId/income-summary", () =>
|
|
HttpResponse.json(
|
|
resource({
|
|
accountId: "account-1",
|
|
calculatedAt: "2026-08-14T00:00:00Z",
|
|
period: { from: "2026-01-01", to: "2026-08-14" },
|
|
totalsByCurrency: [],
|
|
}),
|
|
),
|
|
),
|
|
];
|
|
|
|
export { handlers };
|