opencode/packages/console/app/test/pricing.test.ts
opencode-agent[bot] b1ce938ebe
fix(console): support DeepSeek weekend pricing (#44305)
Co-authored-by: MrMushrooooom <MrMushrooooom@users.noreply.github.com>
Co-authored-by: Frank <frank@anoma.ly>
2026-08-24 01:54:31 -04:00

16 lines
799 B
TypeScript

import { describe, expect, test } from "bun:test"
import { isPeakPricing } from "../src/routes/zen/util/pricing"
describe("isPeakPricing", () => {
test.each([
["weekday 09:00 CN starts peak pricing", "2026-08-27T01:00:00.000Z", true],
["weekday 12:00 CN ends peak pricing", "2026-08-27T04:00:00.000Z", false],
["weekday 14:00 CN starts peak pricing", "2026-08-27T06:00:00.000Z", true],
["weekday 18:00 CN ends peak pricing", "2026-08-27T10:00:00.000Z", false],
["Saturday in Beijing", "2026-08-29T01:00:00.000Z", false],
["Sunday in Beijing", "2026-08-30T06:00:00.000Z", false],
["Monday in Beijing", "2026-08-31T01:00:00.000Z", true],
] as const)("handles %s", (_name, timestamp, expected) => {
expect(isPeakPricing(new Date(timestamp))).toBe(expected)
})
})