Skip to content

Commit f0611c3

Browse files
committed
test(copilot): pin the new-turn usage refusal to an empty 402
1 parent 132ad0c commit f0611c3

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎apps/sim/app/api/copilot/api-keys/validate/route.test.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,15 +251,15 @@ describe('POST /api/copilot/api-keys/validate billing protocols', () => {
251251
expect(mockCheckServerSideUsageLimits).not.toHaveBeenCalled()
252252
})
253253

254-
it("sends a new turn's usage refusal in the shape its contract declares", async () => {
254+
it("sends a new turn's usage refusal as the empty 402 its contract declares", async () => {
255255
mockCheckAttributedUsageLimits.mockResolvedValue({ isExceeded: true, scope: 'payer' })
256256

257257
const res = await POST(request(SELF_HOSTED_VALIDATE_BODY))
258-
const text = await res.text()
259258

260259
expect(res.status).toBe(402)
260+
expect(await res.text()).toBe('')
261261
const refusalSchema = validateCopilotApiKeyContract.response.statusSchemas?.[402]
262-
expect(refusalSchema?.safeParse(text ? JSON.parse(text) : undefined).success).toBe(true)
262+
expect(refusalSchema?.safeParse(undefined).success).toBe(true)
263263
})
264264

265265
it('preserves the actor member cap for markerless self-hosted admission', async () => {

0 commit comments

Comments
 (0)