27 lines
773 B
TypeScript
27 lines
773 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
|
|
import type { IncomeAnalytics } from "@/entities/income";
|
|
|
|
import { toIncomeDisplayModel } from "./display";
|
|
|
|
describe("income payments display", () => {
|
|
it("keeps repeated IDs, order and logo revisions without reconstructing financial data", () => {
|
|
const payment = {
|
|
id: "same",
|
|
instrumentKey: "bond:RUB",
|
|
logoName: null,
|
|
} as IncomeAnalytics["entries"][number];
|
|
|
|
const analytics = {
|
|
entries: [payment, payment, { ...payment, logoName: "bond.png" }],
|
|
} as IncomeAnalytics;
|
|
|
|
const display = toIncomeDisplayModel(analytics);
|
|
|
|
expect(display.entries.map(({ operation }) => operation)).toEqual(
|
|
analytics.entries,
|
|
);
|
|
expect(new Set(display.entries.map(({ key }) => key)).size).toBe(3);
|
|
});
|
|
});
|