Skip to content

Commit 8430ed1

Browse files
committed
chore: update unit tests
1 parent ea44a86 commit 8430ed1

File tree

2 files changed

+8
-17
lines changed

2 files changed

+8
-17
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ export async function getNextProjectCost(
4747
const org = orgResponse.data;
4848
const activeProjects = projectsResponse.data.filter(
4949
(project) =>
50-
project.organization_id === orgId && !['INACTIVE', 'GOING_DOWN', 'REMOVED'].includes(project.status)
50+
project.organization_id === orgId &&
51+
!['INACTIVE', 'GOING_DOWN', 'REMOVED'].includes(project.status)
5152
);
5253

5354
let amount = 0;

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

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ describe('tools', () => {
159159
test('get next project cost for paid org with 0 projects', async () => {
160160
const { callTool } = await setup();
161161

162+
mockProjects.clear();
162163
const paidOrg = mockOrgs.find((org) => org.plan !== 'free')!;
163164
const result = await callTool({
164165
name: 'get_cost',
@@ -173,18 +174,11 @@ describe('tools', () => {
173174
);
174175
});
175176

176-
test('get next project cost for paid org with > 0 ACTIVE_HEALTHY projects', async () => {
177+
test('get next project cost for paid org with > 0 active projects', async () => {
177178
const { callTool } = await setup();
178179

179180
const paidOrg = mockOrgs.find((org) => org.plan !== 'free')!;
180181

181-
const priorProject = await createProject({
182-
name: 'Project 1',
183-
region: 'us-east-1',
184-
organization_id: paidOrg.id,
185-
});
186-
priorProject.status = 'ACTIVE_HEALTHY';
187-
188182
const result = await callTool({
189183
name: 'get_cost',
190184
arguments: {
@@ -198,17 +192,13 @@ describe('tools', () => {
198192
);
199193
});
200194

201-
test('get next project cost for paid org with > 0 projects that are not ACTIVE_HEALTHY', async () => {
195+
test('get next project cost for paid org with > 0 inactive projects', async () => {
202196
const { callTool } = await setup();
203197

204198
const paidOrg = mockOrgs.find((org) => org.plan !== 'free')!;
205-
206-
const priorProject = await createProject({
207-
name: 'Project 1',
208-
region: 'us-east-1',
209-
organization_id: paidOrg.id,
210-
});
211-
priorProject.status = 'INACTIVE';
199+
for (const priorProject of mockProjects.values()) {
200+
priorProject.status = 'INACTIVE';
201+
}
212202

213203
const result = await callTool({
214204
name: 'get_cost',

0 commit comments

Comments
 (0)