Skip to content

Commit 84da910

Browse files
committed
test(context-dev): check the untouched-timeout guard without a cast
1 parent 5db601e commit 84da910

1 file changed

Lines changed: 3 additions & 11 deletions

File tree

‎apps/sim/tools/context_dev/timeout.test.ts‎

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { describe, expect, it } from 'vitest'
22
import { contextDevExtractTool } from '@/tools/context_dev/extract'
33
import { contextDevGetBrandTool } from '@/tools/context_dev/get_brand'
4-
import type { ContextDevExtractParams } from '@/tools/context_dev/types'
4+
import { timeoutOpts } from '@/tools/context_dev/utils'
55

66
/**
77
* Context.dev replaced `timeoutMS` with `timeoutOpts.milliseconds`; its extract and search bodies
@@ -20,16 +20,8 @@ describe('Context.dev request timeout', () => {
2020
expect(body).not.toHaveProperty('timeoutMS')
2121
})
2222

23-
it.each([[''], [null]])('omits the timeout when the field is untouched (%j)', (timeoutMS) => {
24-
const params: Record<string, unknown> = {
25-
apiKey: 'key',
26-
url: 'https://example.com',
27-
schema: { type: 'object' },
28-
timeoutMS,
29-
}
30-
const body = contextDevExtractTool.request.body?.(params as ContextDevExtractParams)
31-
32-
expect(JSON.parse(JSON.stringify(body))).not.toHaveProperty('timeoutOpts')
23+
it.each([[''], [null]])('sends no timeout for an untouched field (%j)', (value) => {
24+
expect(timeoutOpts(value)).toBeUndefined()
3325
})
3426

3527
it('sends the timeout as a timeoutOpts deep-object query parameter', () => {

0 commit comments

Comments
 (0)