Skip to content

Commit bad875c

Browse files
test(cli): reject rollover dates in datetime usage inputs too
1 parent 8b86215 commit bad875c

1 file changed

Lines changed: 16 additions & 14 deletions

File tree

packages/cli/tests/database.test.ts

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -594,20 +594,22 @@ describe("database commands", () => {
594594
it("rejects impossible calendar dates for usage periods", async () => {
595595
const { cwd, stateDir } = await setupLinkedProject();
596596

597-
const result = await executeCli({
598-
argv: ["database", "usage", "db_123", "--from", "2026-02-30", "--json"],
599-
cwd,
600-
stateDir,
601-
fixturePath,
602-
});
603-
const payload = JSON.parse(result.stdout);
604-
605-
expect(result.exitCode).toBe(2);
606-
expect(payload).toMatchObject({
607-
ok: false,
608-
command: "database.usage",
609-
error: { code: "USAGE_ERROR" },
610-
});
597+
for (const from of ["2026-02-30", "2026-02-30T10:00:00Z"]) {
598+
const result = await executeCli({
599+
argv: ["database", "usage", "db_123", "--from", from, "--json"],
600+
cwd,
601+
stateDir,
602+
fixturePath,
603+
});
604+
const payload = JSON.parse(result.stdout);
605+
606+
expect(result.exitCode).toBe(2);
607+
expect(payload).toMatchObject({
608+
ok: false,
609+
command: "database.usage",
610+
error: { code: "USAGE_ERROR" },
611+
});
612+
}
611613
});
612614

613615
it("rejects an invalid usage period before calling the API", async () => {

0 commit comments

Comments
 (0)