Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
token = await createOperatorToken(env.db, admin);
});
afterEach(() => {
vi.useRealTimers();
vi.restoreAllMocks();
vi.unstubAllGlobals();
});
Expand Down Expand Up @@ -192,6 +193,10 @@
const formerOwner = await createTestUser(env.db, 'operator-usage-former');
const currentOwner = await createTestUser(env.db, 'operator-usage-current');
const project = await createTestProject(env.db, currentOwner.id, 'operator-usage-project');
// Both ownership intervals must fall inside the billing period anchored on
// the 1st, so pin the clock mid-month instead of relying on today's date.
vi.useFakeTimers({ toFake: ['Date'] });
vi.setSystemTime(new Date('2026-07-15T12:00:00.000Z'));
const ownedFrom = new Date(Date.now() - 5 * 24 * 60 * 60 * 1_000);
const transferredAt = new Date(Date.now() - 2 * 24 * 60 * 60 * 1_000);
transferredAt.setMilliseconds(500);
Expand Down Expand Up @@ -230,7 +235,7 @@
return Response.json({
data: [{ blob1: project.id, requests: 12, bandwidth_bytes: 34 }],
});
}),

Check failure on line 238 in platform/packages/api/test/integration/operator-tenants.test.ts

View workflow job for this annotation

GitHub Actions / schema-compat

[platform-api-integration] platform/packages/api/test/integration/operator-tenants.test.ts > operator tenant reads > attributes operator user usage only to ownership intervals in the billing window

AssertionError: expected { …(4) } to match object { projects: [], usage: { …(2) } } (14 matching properties omitted from actual) - Expected + Received { "projects": [], "usage": { - "projects": [ - { - "projectId": "proj_test5", - "slug": "operator-usage-project", - }, - ], - "totalRequests": 12, + "projects": [], + "totalRequests": 0, }, } ❯ platform/packages/api/test/integration/operator-tenants.test.ts:238:41
);

const formerResponse = await req(`/users/${formerOwner.id}`);
Expand Down
Loading