feat: show persisted investment data and sync state
Consume the provided resource-envelope API snapshot. Preserve financial snapshots during refresh, observe synchronization without importing, and fence late responses across account and connection changes.
This commit is contained in:
+38
-27
@@ -1,4 +1,5 @@
|
||||
import { HttpResponse, http } from "msw";
|
||||
import { resource } from "@/test/resource";
|
||||
|
||||
const authentication = {
|
||||
accessToken: "test-token",
|
||||
@@ -26,40 +27,50 @@ const handlers = [
|
||||
"*/api/v1/tbank-connection",
|
||||
() => new HttpResponse(null, { status: 204 }),
|
||||
),
|
||||
http.get("*/api/v1/brokerage-accounts", () => HttpResponse.json([])),
|
||||
http.get("*/api/v1/brokerage-accounts", () =>
|
||||
HttpResponse.json(resource([])),
|
||||
),
|
||||
http.get("*/api/v1/brokerage-accounts/:accountId/portfolio", () =>
|
||||
HttpResponse.json({
|
||||
lastSuccessfulAt: "2026-08-14T00:00:00Z",
|
||||
isStale: false,
|
||||
totalsByCurrency: [],
|
||||
positions: [],
|
||||
structure: { currencies: [], unvaluedCategories: [] },
|
||||
cashBalances: [],
|
||||
}),
|
||||
HttpResponse.json(
|
||||
resource({
|
||||
lastSuccessfulAt: "2026-08-14T00:00:00Z",
|
||||
isStale: false,
|
||||
totalsByCurrency: [],
|
||||
positions: [],
|
||||
structure: { currencies: [], unvaluedCategories: [] },
|
||||
cashBalances: [],
|
||||
}),
|
||||
),
|
||||
),
|
||||
http.get("*/api/v1/brokerage-accounts/:accountId/operations", () =>
|
||||
HttpResponse.json({
|
||||
accountId: "account-1",
|
||||
items: [],
|
||||
nextCursor: null,
|
||||
hasNext: false,
|
||||
observedAt: "2026-08-14T00:00:00Z",
|
||||
}),
|
||||
HttpResponse.json(
|
||||
resource({
|
||||
accountId: "account-1",
|
||||
items: [],
|
||||
nextCursor: null,
|
||||
hasNext: false,
|
||||
observedAt: "2026-08-14T00:00:00Z",
|
||||
}),
|
||||
),
|
||||
),
|
||||
http.get("*/api/v1/brokerage-accounts/:accountId/events", () =>
|
||||
HttpResponse.json({
|
||||
accountId: "account-1",
|
||||
calculatedAt: "2026-08-14T00:00:00Z",
|
||||
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({
|
||||
accountId: "account-1",
|
||||
period: { from: "2026-01-01", to: "2026-08-14" },
|
||||
totalsByCurrency: [],
|
||||
calculatedAt: "2026-08-14T00:00:00Z",
|
||||
}),
|
||||
HttpResponse.json(
|
||||
resource({
|
||||
accountId: "account-1",
|
||||
period: { from: "2026-01-01", to: "2026-08-14" },
|
||||
totalsByCurrency: [],
|
||||
calculatedAt: "2026-08-14T00:00:00Z",
|
||||
}),
|
||||
),
|
||||
),
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user