Skip to content

Commit 268cdc0

Browse files
committed
fix(integrations): send ashby get_job's flag only when it is a boolean and shrink the test-types baseline
1 parent 56acc4c commit 268cdc0

3 files changed

Lines changed: 16 additions & 6 deletions

File tree

‎apps/sim/tools/ashby/ashby.test.ts‎

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,18 @@ import { setCustomFieldValuesTool } from '@/tools/ashby/set_custom_field_values'
2222
import { transferApplicationTool } from '@/tools/ashby/transfer_application'
2323
import { updateCandidateTool } from '@/tools/ashby/update_candidate'
2424
import { ashbyAuthHeaders } from '@/tools/ashby/utils'
25-
import type { ToolConfig } from '@/tools/types'
2625

2726
const respond = (body: unknown) => new Response(JSON.stringify(body), { status: 200 })
2827

29-
function requestBody<P, R>(tool: ToolConfig<P, R>, params: unknown): Record<string, unknown> {
28+
function requestBody(
29+
tool: { request?: { body?: unknown } },
30+
params: unknown
31+
): Record<string, unknown> {
3032
const build = tool.request?.body as (p: unknown) => Record<string, unknown>
3133
return build(params)
3234
}
3335

34-
async function transform<P, R>(tool: ToolConfig<P, R>, body: unknown) {
36+
async function transform(tool: { transformResponse?: unknown }, body: unknown) {
3537
const run = tool.transformResponse as (r: Response) => Promise<{ output: Record<string, never> }>
3638
return run(respond(body))
3739
}
@@ -274,6 +276,15 @@ describe('ashby request bodies', () => {
274276
})
275277
expect(body).toMatchObject({ id: 'j', includeUnpublishedJobPostingsIds: true })
276278
expect(body).not.toHaveProperty('includeUnpublishedJobPostingIds')
279+
for (const untouched of [null, '']) {
280+
expect(
281+
requestBody(getJobTool, {
282+
apiKey: 'k',
283+
jobId: 'j',
284+
includeUnpublishedJobPostingIds: untouched,
285+
})
286+
).toEqual({ id: 'j', expand: ['openings', 'location', 'compensation'] })
287+
}
277288
})
278289

279290
it('change_application_source sends sourceId when one is provided', () => {

‎apps/sim/tools/ashby/get_job.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export const getJobTool: ToolConfig<AshbyGetJobParams, AshbyGetJobResponse> = {
3838
body: (params) => ({
3939
id: params.jobId.trim(),
4040
expand: ['openings', 'location', 'compensation'],
41-
...(params.includeUnpublishedJobPostingIds !== undefined
41+
...(typeof params.includeUnpublishedJobPostingIds === 'boolean'
4242
? { includeUnpublishedJobPostingsIds: params.includeUnpublishedJobPostingIds }
4343
: {}),
4444
}),

‎scripts/check-test-types.baseline.json‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2574,8 +2574,7 @@
25742574
"TS2345": 25
25752575
},
25762576
"apps/sim/tools/ashby/ashby.test.ts": {
2577-
"TS2339": 3,
2578-
"TS2345": 50
2577+
"TS2339": 3
25792578
},
25802579
"apps/sim/tools/assistant-execution.test.ts": {
25812580
"TS2554": 2

0 commit comments

Comments
 (0)