Skip to content

Commit 4c32788

Browse files
committed
Fix TypeScript errors in output.test.ts for MCP SDK 1.24.3
- Added type guards for all content.type checks in output.test.ts - Fixed 4 test assertions requiring type guards - Final test file fix for MCP SDK compatibility ✅ All 150 tests passing ✅ All 14 test suites passing ✅ Zero TypeScript errors ✅ Complete compatibility with MCP SDK 1.24.3
1 parent bee5130 commit 4c32788

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

src/__tests__/tools/browser/output.test.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,10 @@ describe('Browser Output Tools', () => {
6868
}
6969
});
7070
expect(result.isError).toBe(false);
71-
expect(result.content[0].text).toContain('Saved page as PDF');
71+
expect(result.content[0].type).toBe('text');
72+
if (result.content[0].type === 'text') {
73+
expect(result.content[0].text).toContain('Saved page as PDF');
74+
}
7275
});
7376

7477
test('should save page as PDF with custom options', async () => {
@@ -99,7 +102,10 @@ describe('Browser Output Tools', () => {
99102
}
100103
});
101104
expect(result.isError).toBe(false);
102-
expect(result.content[0].text).toContain('Saved page as PDF');
105+
expect(result.content[0].type).toBe('text');
106+
if (result.content[0].type === 'text') {
107+
expect(result.content[0].text).toContain('Saved page as PDF');
108+
}
103109
});
104110

105111
test('should handle PDF generation errors', async () => {
@@ -114,7 +120,10 @@ describe('Browser Output Tools', () => {
114120

115121
expect(mockPdf).toHaveBeenCalled();
116122
expect(result.isError).toBe(true);
117-
expect(result.content[0].text).toContain('Operation failed');
123+
expect(result.content[0].type).toBe('text');
124+
if (result.content[0].type === 'text') {
125+
expect(result.content[0].text).toContain('Operation failed');
126+
}
118127
});
119128

120129
test('should handle missing page', async () => {
@@ -126,7 +135,10 @@ describe('Browser Output Tools', () => {
126135

127136
expect(mockPdf).not.toHaveBeenCalled();
128137
expect(result.isError).toBe(true);
129-
expect(result.content[0].text).toContain('Browser page not initialized');
138+
expect(result.content[0].type).toBe('text');
139+
if (result.content[0].type === 'text') {
140+
expect(result.content[0].text).toContain('Browser page not initialized');
141+
}
130142
});
131143
});
132144
});

0 commit comments

Comments
 (0)