Skip to content

Commit 3f13b01

Browse files
committed
fix: validation error tests
1 parent 4e221a0 commit 3f13b01

File tree

2 files changed

+9
-17
lines changed

2 files changed

+9
-17
lines changed

packages/mcp-server-supabase/src/server.test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -628,9 +628,7 @@ describe('tools', () => {
628628
service: invalidService,
629629
},
630630
});
631-
await expect(getLogsPromise).rejects.toThrow(
632-
`unsupported log service type: invalid-service`
633-
);
631+
await expect(getLogsPromise).rejects.toThrow('Invalid enum value');
634632
});
635633

636634
test('create branch', async () => {

packages/mcp-server-supabase/src/server.ts

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -178,16 +178,13 @@ export function createSupabaseMcpServer(options: SupabaseMcpServerOptions) {
178178
),
179179
organization_id: z.string(),
180180
confirm_cost_id: z
181-
.string()
181+
.string({
182+
required_error:
183+
'User must confirm understanding of costs before creating a project.',
184+
})
182185
.describe('The cost confirmation ID. Call `confirm_cost` first.'),
183186
}),
184187
execute: async ({ name, region, organization_id, confirm_cost_id }) => {
185-
if (!confirm_cost_id) {
186-
throw new Error(
187-
'User must confirm understanding of costs before creating a project.'
188-
);
189-
}
190-
191188
const cost = await getNextProjectCost(
192189
managementApiClient,
193190
organization_id
@@ -513,16 +510,13 @@ export function createSupabaseMcpServer(options: SupabaseMcpServerOptions) {
513510
.default('develop')
514511
.describe('Name of the branch to create'),
515512
confirm_cost_id: z
516-
.string()
513+
.string({
514+
required_error:
515+
'User must confirm understanding of costs before creating a branch.',
516+
})
517517
.describe('The cost confirmation ID. Call `confirm_cost` first.'),
518518
}),
519519
execute: async ({ project_id, name, confirm_cost_id }) => {
520-
if (!confirm_cost_id) {
521-
throw new Error(
522-
'User must confirm understanding of costs before creating a branch.'
523-
);
524-
}
525-
526520
const cost = getBranchCost();
527521
const costHash = await hashObject(cost);
528522
if (costHash !== confirm_cost_id) {

0 commit comments

Comments
 (0)