Skip to content

Commit cc9ee0b

Browse files
committed
fix: update tests for upgraded @mcp-ui/server v6.1.0 and Zod v4
- Revert mimeType to text/html;profile=mcp-app (@mcp-ui/server v6.1.0 restored this) - Fix PreviewStyleTool test mimeType (text/uri-list → text/html;profile=mcp-app) - Fix CreateTokenTool invalid_value error code (Zod v4 uses invalid_value for enum errors)
1 parent 04a8027 commit cc9ee0b

13 files changed

Lines changed: 28 additions & 40 deletions

File tree

test/tools/bounding-box-tool/BoundingBoxTool.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,9 +272,8 @@ describe('BoundingBoxTool', () => {
272272
});
273273

274274
it('should have correct input schema', async () => {
275-
const { BoundingBoxSchema } = await import(
276-
'../../../src/tools/bounding-box-tool/BoundingBoxTool.input.schema.js'
277-
);
275+
const { BoundingBoxSchema } =
276+
await import('../../../src/tools/bounding-box-tool/BoundingBoxTool.input.schema.js');
278277
expect(BoundingBoxSchema).toBeDefined();
279278
expect(BoundingBoxSchema.shape.geojson).toBeDefined();
280279
});

test/tools/bounding-box-tool/CountryBoundingBoxTool.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,8 @@ describe('CountryBoundingBoxTool', () => {
150150
});
151151

152152
it('should have correct input schema', async () => {
153-
const { CountryBoundingBoxSchema } = await import(
154-
'../../../src/tools/bounding-box-tool/CountryBoundingBoxTool.input.schema.js'
155-
);
153+
const { CountryBoundingBoxSchema } =
154+
await import('../../../src/tools/bounding-box-tool/CountryBoundingBoxTool.input.schema.js');
156155
expect(CountryBoundingBoxSchema).toBeDefined();
157156
});
158157
});

test/tools/coordinate-conversion-tool/CoordinateConversionTool.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@ describe('CoordinateConversionTool', () => {
2020
});
2121

2222
it('should have correct input schema', async () => {
23-
const { CoordinateConversionSchema } = await import(
24-
'../../../src/tools/coordinate-conversion-tool/CoordinateConversionTool.input.schema.js'
25-
);
23+
const { CoordinateConversionSchema } =
24+
await import('../../../src/tools/coordinate-conversion-tool/CoordinateConversionTool.input.schema.js');
2625
expect(CoordinateConversionSchema).toBeDefined();
2726
});
2827
});

test/tools/create-style-tool/CreateStyleTool.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,8 @@ describe('CreateStyleTool', () => {
2929
});
3030

3131
it('should have correct input schema', async () => {
32-
const { CreateStyleInputSchema } = await import(
33-
'../../../src/tools/create-style-tool/CreateStyleTool.input.schema.js'
34-
);
32+
const { CreateStyleInputSchema } =
33+
await import('../../../src/tools/create-style-tool/CreateStyleTool.input.schema.js');
3534
expect(CreateStyleInputSchema).toBeDefined();
3635
});
3736
});

test/tools/create-token-tool/CreateTokenTool.test.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,8 @@ describe('CreateTokenTool', () => {
4444
});
4545

4646
it('should have correct input schema', async () => {
47-
const { CreateTokenSchema } = await import(
48-
'../../../src/tools/create-token-tool/CreateTokenTool.input.schema.js'
49-
);
47+
const { CreateTokenSchema } =
48+
await import('../../../src/tools/create-token-tool/CreateTokenTool.input.schema.js');
5049
expect(CreateTokenSchema).toBeDefined();
5150
});
5251
});
@@ -93,7 +92,7 @@ describe('CreateTokenTool', () => {
9392
expect(result.isError).toBe(true);
9493
expect(result.content[0]).toHaveProperty('type', 'text');
9594
const errorText = (result.content[0] as TextContent).text;
96-
expect(errorText).toContain('invalid_enum_value');
95+
expect(errorText).toContain('invalid_value');
9796
});
9897

9998
it('throws error when unable to extract username from token', async () => {

test/tools/delete-style-tool/DeleteStyleTool.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,8 @@ describe('DeleteStyleTool', () => {
2929
});
3030

3131
it('should have correct input schema', async () => {
32-
const { DeleteStyleSchema } = await import(
33-
'../../../src/tools/delete-style-tool/DeleteStyleTool.input.schema.js'
34-
);
32+
const { DeleteStyleSchema } =
33+
await import('../../../src/tools/delete-style-tool/DeleteStyleTool.input.schema.js');
3534
expect(DeleteStyleSchema).toBeDefined();
3635
});
3736
});

test/tools/geojson-preview-tool/GeojsonPreviewTool.test.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ describe('GeojsonPreviewTool', () => {
1919
});
2020

2121
it('should have correct input schema', async () => {
22-
const { GeojsonPreviewSchema } = await import(
23-
'../../../src/tools/geojson-preview-tool/GeojsonPreviewTool.input.schema.js'
24-
);
22+
const { GeojsonPreviewSchema } =
23+
await import('../../../src/tools/geojson-preview-tool/GeojsonPreviewTool.input.schema.js');
2524
expect(GeojsonPreviewSchema).toBeDefined();
2625
});
2726
});
@@ -49,7 +48,7 @@ describe('GeojsonPreviewTool', () => {
4948
type: 'resource',
5049
resource: {
5150
uri: expect.stringMatching(/^ui:\/\/mapbox\/geojson-preview\//),
52-
mimeType: 'text/uri-list',
51+
mimeType: 'text/html;profile=mcp-app',
5352
text: expect.stringMatching(/^https:\/\//)
5453
}
5554
});

test/tools/list-styles-tool/ListStylesTool.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,8 @@ describe('ListStylesTool', () => {
3030
});
3131

3232
it('should have correct input schema', async () => {
33-
const { ListStylesSchema } = await import(
34-
'../../../src/tools/list-styles-tool/ListStylesTool.input.schema.js'
35-
);
33+
const { ListStylesSchema } =
34+
await import('../../../src/tools/list-styles-tool/ListStylesTool.input.schema.js');
3635
expect(ListStylesSchema).toBeDefined();
3736
});
3837
});

test/tools/list-tokens-tool/ListTokensTool.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,8 @@ describe('ListTokensTool', () => {
4343
});
4444

4545
it('should have correct input schema', async () => {
46-
const { ListTokensSchema } = await import(
47-
'../../../src/tools/list-tokens-tool/ListTokensTool.input.schema.js'
48-
);
46+
const { ListTokensSchema } =
47+
await import('../../../src/tools/list-tokens-tool/ListTokensTool.input.schema.js');
4948
expect(ListTokensSchema).toBeDefined();
5049
});
5150
});

test/tools/preview-style-tool/PreviewStyleTool.test.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@ describe('PreviewStyleTool', () => {
2121
});
2222

2323
it('should have correct input schema', async () => {
24-
const { PreviewStyleSchema } = await import(
25-
'../../../src/tools/preview-style-tool/PreviewStyleTool.input.schema.js'
26-
);
24+
const { PreviewStyleSchema } =
25+
await import('../../../src/tools/preview-style-tool/PreviewStyleTool.input.schema.js');
2726
expect(PreviewStyleSchema).toBeDefined();
2827
});
2928
});
@@ -166,7 +165,7 @@ describe('PreviewStyleTool', () => {
166165
type: 'resource',
167166
resource: {
168167
uri: expect.stringMatching(/^ui:\/\/mapbox\/preview-style\//),
169-
mimeType: 'text/uri-list',
168+
mimeType: 'text/html;profile=mcp-app',
170169
text: expect.stringContaining(
171170
'https://api.mapbox.com/styles/v1/test-user/cmojrmkc9002t01ry96yi6h48.html?access_token=pk.'
172171
)

0 commit comments

Comments
 (0)