import { describe, expect, it } from 'vitest'; import { isAllocationHoldActive } from '../src/services/bidRoundService'; describe('isAllocationHoldActive', () => { it('false when no hold_until', () => { expect(isAllocationHoldActive({})).toBe(false); expect(isAllocationHoldActive({ allocation_hold_until: null })).toBe(false); }); it('false when already released', () => { expect( isAllocationHoldActive({ allocation_hold_until: new Date(Date.now() + 60_000).toISOString(), allocation_hold_released_at: new Date().toISOString(), }) ).toBe(false); }); it('true when until in future and not released', () => { expect( isAllocationHoldActive({ allocation_hold_until: new Date(Date.now() + 60_000).toISOString(), }) ).toBe(true); }); it('false when until already passed', () => { expect( isAllocationHoldActive({ allocation_hold_until: new Date(Date.now() - 60_000).toISOString(), }) ).toBe(false); }); });