Skip to content

Commit c5abf17

Browse files
committed
update unit tests
1 parent 2c7346e commit c5abf17

File tree

2 files changed

+31
-15
lines changed

2 files changed

+31
-15
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ type SetupOptions = {
1313
accessToken?: string;
1414
projectId?: string;
1515
readOnly?: boolean;
16+
features?: string[];
1617
};
1718

1819
async function setup(options: SetupOptions = {}) {
19-
const { accessToken = ACCESS_TOKEN, projectId, readOnly } = options;
20+
const { accessToken = ACCESS_TOKEN, projectId, readOnly, features } = options;
2021
const clientTransport = new StreamTransport();
2122
const serverTransport = new StreamTransport();
2223

@@ -40,6 +41,7 @@ async function setup(options: SetupOptions = {}) {
4041
},
4142
projectId,
4243
readOnly,
44+
features,
4345
});
4446

4547
await server.connect(serverTransport);

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

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,14 @@ type SetupOptions = {
3939
accessToken?: string;
4040
projectId?: string;
4141
readOnly?: boolean;
42+
features?: string[];
4243
};
4344

4445
/**
4546
* Sets up an MCP client and server for testing.
4647
*/
4748
async function setup(options: SetupOptions = {}) {
48-
const { accessToken = ACCESS_TOKEN, projectId, readOnly } = options;
49+
const { accessToken = ACCESS_TOKEN, projectId, readOnly, features } = options;
4950
const clientTransport = new StreamTransport();
5051
const serverTransport = new StreamTransport();
5152

@@ -71,6 +72,7 @@ async function setup(options: SetupOptions = {}) {
7172
platform,
7273
projectId,
7374
readOnly,
75+
features,
7476
});
7577

7678
await server.connect(serverTransport);
@@ -495,7 +497,7 @@ describe('tools', () => {
495497
});
496498

497499
test('get project url', async () => {
498-
const { callTool } = await setup();
500+
const { callTool } = await setup({ features: ['development'] });
499501

500502
const org = await createOrganization({
501503
name: 'My Org',
@@ -520,7 +522,7 @@ describe('tools', () => {
520522
});
521523

522524
test('get anon key', async () => {
523-
const { callTool } = await setup();
525+
const { callTool } = await setup({ features: ['development'] });
524526
const org = await createOrganization({
525527
name: 'My Org',
526528
plan: 'free',
@@ -543,7 +545,7 @@ describe('tools', () => {
543545
});
544546

545547
test('list storage buckets', async () => {
546-
const { callTool } = await setup();
548+
const { callTool } = await setup({ features: ['storage'] });
547549

548550
const org = await createOrganization({
549551
name: 'My Org',
@@ -589,7 +591,7 @@ describe('tools', () => {
589591
});
590592

591593
test('get storage config', async () => {
592-
const { callTool } = await setup();
594+
const { callTool } = await setup({ features: ['storage'] });
593595

594596
const org = await createOrganization({
595597
name: 'My Org',
@@ -621,7 +623,7 @@ describe('tools', () => {
621623
});
622624

623625
test('update storage config', async () => {
624-
const { callTool } = await setup();
626+
const { callTool } = await setup({ features: ['storage'] });
625627

626628
const org = await createOrganization({
627629
name: 'My Org',
@@ -1559,7 +1561,9 @@ describe('tools', () => {
15591561
});
15601562

15611563
test('create branch', async () => {
1562-
const { callTool } = await setup();
1564+
const { callTool } = await setup({
1565+
features: ['account', 'branching', 'database'],
1566+
});
15631567

15641568
const org = await createOrganization({
15651569
name: 'My Org',
@@ -1611,7 +1615,7 @@ describe('tools', () => {
16111615
});
16121616

16131617
test('create branch without cost confirmation fails', async () => {
1614-
const { callTool } = await setup();
1618+
const { callTool } = await setup({ features: ['branching'] });
16151619

16161620
const org = await createOrganization({
16171621
name: 'Paid Org',
@@ -1641,7 +1645,9 @@ describe('tools', () => {
16411645
});
16421646

16431647
test('delete branch', async () => {
1644-
const { callTool } = await setup();
1648+
const { callTool } = await setup({
1649+
features: ['account', 'branching', 'database'],
1650+
});
16451651

16461652
const org = await createOrganization({
16471653
name: 'My Org',
@@ -1720,7 +1726,7 @@ describe('tools', () => {
17201726
});
17211727

17221728
test('list branches', async () => {
1723-
const { callTool } = await setup();
1729+
const { callTool } = await setup({ features: ['branching'] });
17241730

17251731
const org = await createOrganization({
17261732
name: 'My Org',
@@ -1746,7 +1752,9 @@ describe('tools', () => {
17461752
});
17471753

17481754
test('merge branch', async () => {
1749-
const { callTool } = await setup();
1755+
const { callTool } = await setup({
1756+
features: ['account', 'branching', 'database'],
1757+
});
17501758

17511759
const org = await createOrganization({
17521760
name: 'My Org',
@@ -1813,7 +1821,9 @@ describe('tools', () => {
18131821
});
18141822

18151823
test('reset branch', async () => {
1816-
const { callTool } = await setup();
1824+
const { callTool } = await setup({
1825+
features: ['account', 'branching', 'database'],
1826+
});
18171827

18181828
const org = await createOrganization({
18191829
name: 'My Org',
@@ -1889,7 +1899,9 @@ describe('tools', () => {
18891899
});
18901900

18911901
test('revert migrations', async () => {
1892-
const { callTool } = await setup();
1902+
const { callTool } = await setup({
1903+
features: ['account', 'branching', 'database'],
1904+
});
18931905

18941906
const org = await createOrganization({
18951907
name: 'My Org',
@@ -1989,7 +2001,9 @@ describe('tools', () => {
19892001
});
19902002

19912003
test('rebase branch', async () => {
1992-
const { callTool } = await setup();
2004+
const { callTool } = await setup({
2005+
features: ['account', 'branching', 'database'],
2006+
});
19932007

19942008
const org = await createOrganization({
19952009
name: 'My Org',

0 commit comments

Comments
 (0)