Skip to content

Commit e73ed2d

Browse files
committed
test(billing): freeze the clock for exact deadline assertions
1 parent abc8ac6 commit e73ed2d

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎apps/sim/lib/billing/core/usage-log.test.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
billingSubscriptionUtilsMock,
66
billingSubscriptionUtilsMockFns,
77
} from '@sim/testing/mocks/billing-subscription-utils.mock'
8-
import { afterAll, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest'
8+
import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest'
99

1010
const {
1111
mockInsert,
@@ -455,9 +455,14 @@ describe('ledger aggregates', () => {
455455
]
456456

457457
beforeEach(() => {
458+
vi.useFakeTimers({ toFake: ['Date'] })
458459
installSharedDbMocks()
459460
})
460461

462+
afterEach(() => {
463+
vi.useRealTimers()
464+
})
465+
461466
for (const aggregate of aggregates) {
462467
it(`${aggregate.name} reads through the bounded ledger transaction`, async () => {
463468
const execute = vi.fn().mockResolvedValue([])

0 commit comments

Comments
 (0)