settlekit/packages/analytics/test/analytics.test.ts
caelum0x 4afda54455 feat: monorepo scaffold + @settlekit/common contract package
- pnpm workspace, shared tsconfig, vitest
- common: ids, money (USDC base-unit math), Result/SettleKitError, time
- domain types: product, customer, payment, entitlement, delivery, integration
- 13 passing contract tests
2026-06-15 02:55:22 +03:00

10 lines
520 B
TypeScript

import { describe, expect, it } from "vitest";
import { conversionRate, totalConfirmedRevenue } from "../src/index.js";
describe("analytics", () => {
it("calculates revenue and conversion", () => {
expect(totalConfirmedRevenue([{ id: "pay_1", organizationId: "org_1", checkoutSessionId: "cs_1", customerId: "cus_1", amount: { amount: "1.5", currency: "USDC" }, network: "arc", confirmations: 1, status: "confirmed", createdAt: "" }]).amount).toBe("1.5");
expect(conversionRate(25, 100)).toBe(0.25);
});
});