Skip to content

Commit 021b6bc

Browse files
committed
Fix tests
1 parent ec51d28 commit 021b6bc

File tree

1 file changed

+13
-52
lines changed

1 file changed

+13
-52
lines changed

web/src/llm-api/__tests__/fireworks-deployment.test.ts

Lines changed: 13 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
DEPLOYMENT_COOLDOWN_MS,
66
FireworksError,
77
isDeploymentCoolingDown,
8-
isDeploymentHours,
98
markDeploymentScalingUp,
109
resetDeploymentCooldown,
1110
} from '../fireworks'
@@ -36,40 +35,6 @@ function dateAtEtHour(hour: number): Date {
3635
}
3736

3837
describe('Fireworks deployment routing', () => {
39-
describe('isDeploymentHours', () => {
40-
it('returns true at 10am ET (start of window)', () => {
41-
expect(isDeploymentHours(dateAtEtHour(10))).toBe(true)
42-
})
43-
44-
it('returns true at 2pm ET (mid-day)', () => {
45-
expect(isDeploymentHours(dateAtEtHour(14))).toBe(true)
46-
})
47-
48-
it('returns true at 7pm ET (19:00, near end of window)', () => {
49-
expect(isDeploymentHours(dateAtEtHour(19))).toBe(true)
50-
})
51-
52-
it('returns false at 9am ET (before window)', () => {
53-
expect(isDeploymentHours(dateAtEtHour(9))).toBe(false)
54-
})
55-
56-
it('returns false at 8pm ET (20:00, window closed)', () => {
57-
expect(isDeploymentHours(dateAtEtHour(20))).toBe(false)
58-
})
59-
60-
it('returns false at midnight ET', () => {
61-
expect(isDeploymentHours(dateAtEtHour(0))).toBe(false)
62-
})
63-
64-
it('returns false at 3am ET', () => {
65-
expect(isDeploymentHours(dateAtEtHour(3))).toBe(false)
66-
})
67-
68-
it('returns false at 11pm ET', () => {
69-
expect(isDeploymentHours(dateAtEtHour(23))).toBe(false)
70-
})
71-
})
72-
7338
describe('deployment cooldown', () => {
7439
beforeEach(() => {
7540
resetDeploymentCooldown()
@@ -139,8 +104,7 @@ describe('Fireworks deployment routing', () => {
139104
return spy
140105
}
141106

142-
it('uses standard API outside deployment hours', async () => {
143-
const spy = spyDeploymentHours(false)
107+
it('uses standard API when custom deployment is disabled', async () => {
144108
const fetchCalls: string[] = []
145109

146110
const mockFetch = mock(async (_url: string | URL | Request, init?: RequestInit) => {
@@ -149,21 +113,18 @@ describe('Fireworks deployment routing', () => {
149113
return new Response(JSON.stringify({ ok: true }), { status: 200 })
150114
}) as unknown as typeof globalThis.fetch
151115

152-
try {
153-
const response = await createFireworksRequestWithFallback({
154-
body: minimalBody as never,
155-
originalModel: 'minimax/minimax-m2.5',
156-
fetch: mockFetch,
157-
logger,
158-
sessionId: 'test-user-id',
159-
})
160-
161-
expect(response.status).toBe(200)
162-
expect(fetchCalls).toHaveLength(1)
163-
expect(fetchCalls[0]).toBe(STANDARD_MODEL_ID)
164-
} finally {
165-
spy.restore()
166-
}
116+
const response = await createFireworksRequestWithFallback({
117+
body: minimalBody as never,
118+
originalModel: 'minimax/minimax-m2.5',
119+
fetch: mockFetch,
120+
logger,
121+
useCustomDeployment: false,
122+
sessionId: 'test-user-id',
123+
})
124+
125+
expect(response.status).toBe(200)
126+
expect(fetchCalls).toHaveLength(1)
127+
expect(fetchCalls[0]).toBe(STANDARD_MODEL_ID)
167128
})
168129

169130
it('tries custom deployment during deployment hours', async () => {

0 commit comments

Comments
 (0)