feat(contacts): cari kişiler, hesap ↔ cari transferleri, cari ekstresi ve vade uyarısı, 007 migration

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-05 11:58:37 +03:00
parent dfb83d6fd4
commit 5d370a062e
18 changed files with 1060 additions and 26 deletions
+25
View File
@@ -0,0 +1,25 @@
import { describe, expect, it } from "vitest";
import { contactDelta, dueState, isOutgoing } from "./contacts";
import { addDays } from "./recurrence";
describe("cari", () => {
it("yön ve bakiye etkisi", () => {
expect(isOutgoing("lend")).toBe(true);
expect(isOutgoing("repay")).toBe(true);
expect(isOutgoing("borrow")).toBe(false);
expect(contactDelta("lend", 100)).toBe(100);
expect(contactDelta("repay", 100)).toBe(100);
expect(contactDelta("borrow", 100)).toBe(-100);
expect(contactDelta("collect", 100)).toBe(-100);
});
it("vade durumu", () => {
const today = "2026-11-05";
expect(dueState(100, null, 3, today, addDays)).toBe("none");
expect(dueState(0, "2026-11-01", 3, today, addDays)).toBe("none");
expect(dueState(-100, "2026-11-04", 3, today, addDays)).toBe("overdue");
expect(dueState(100, "2026-11-08", 3, today, addDays)).toBe("upcoming");
expect(dueState(100, "2026-11-09", 3, today, addDays)).toBe("none");
expect(dueState(100, "2026-11-05", 0, today, addDays)).toBe("upcoming");
});
});