auth-sso-pricing.test.ts17 lines · main
1import { describe, expect, test } from 'bun:test';
2
3import { currentUtcHourStart } from './auth-sso-pricing.js';
4
5describe('auth-sso-pricing helpers', () => {
6 test('currentUtcHourStart floors to the hour in UTC', () => {
7 const d = new Date('2026-07-22T15:47:33.123Z');
8 const hour = currentUtcHourStart(d);
9 expect(hour.toISOString()).toBe('2026-07-22T15:00:00.000Z');
10 });
11
12 test('same hour for any minute within the hour', () => {
13 const a = currentUtcHourStart(new Date('2026-01-01T00:00:00.000Z'));
14 const b = currentUtcHourStart(new Date('2026-01-01T00:59:59.999Z'));
15 expect(a.getTime()).toBe(b.getTime());
16 });
17});