Skip to content

Commit db8fbce

Browse files
fix(slack): default unresolved channel limits
1 parent a88a4ee commit db8fbce

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

apps/sim/tools/slack/list_channels.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,15 @@ describe('Slack list channels', () => {
4848
)
4949
})
5050

51+
it('uses the default limit for unresolved optional workflow values', () => {
52+
expect(requestUrl({ ...BASE_PARAMS, limit: null as never }).searchParams.get('limit')).toBe(
53+
'100'
54+
)
55+
expect(requestUrl({ ...BASE_PARAMS, limit: ' ' as never }).searchParams.get('limit')).toBe(
56+
'100'
57+
)
58+
})
59+
5160
it('preserves the documented type and participant fields for mixed conversations', async () => {
5261
const result = await slackListChannelsTool.transformResponse!(
5362
Response.json({

apps/sim/tools/slack/list_channels.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ function resolveBooleanParam(value: unknown, label: string, defaultValue: boolea
7070
}
7171

7272
function resolveConversationLimit(value: unknown): number {
73-
if (value === undefined) return 100
73+
if (value === undefined || value === null || (typeof value === 'string' && value.trim() === '')) {
74+
return 100
75+
}
7476
const limit = Number(value)
7577
if (!Number.isInteger(limit) || limit < 1 || limit > 200) {
7678
throw new Error('Channel limit must be an integer between 1 and 200')

0 commit comments

Comments
 (0)