Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/__tests__/__snapshots__/options.defaults.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ exports[`options defaults should return specific properties: defaults 1`] = `
],
},
"xhrFetch": {
"allowBinary": false,
"maxSizeBytes": 5242880,
"preflightHead": false,
"timeoutMs": 15000,
},
}
Expand Down
25 changes: 23 additions & 2 deletions src/__tests__/resource.patternFlyDocsTemplate.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { readFile } from 'node:fs/promises';
import { ReadableStream } from 'node:stream/web';
import { McpError } from '@modelcontextprotocol/sdk/types.js';
import {
patternFlyDocsTemplateResource,
Expand Down Expand Up @@ -76,7 +77,17 @@ describe('resourceCallback', () => {
mockReadFile.mockResolvedValue(mockContent);
mockFetch.mockResolvedValue({
ok: true,
text: () => mockContent
status: 200,
statusText: 'OK',
headers: {
get: (name: string) => (name === 'content-type' ? 'text/plain' : null)
},
body: new ReadableStream({
start(controller) {
controller.enqueue(new TextEncoder().encode(mockContent));
controller.close();
}
})
} as any);

const result = await resourceCallback(
Expand Down Expand Up @@ -151,7 +162,17 @@ describe('resourceCallback', () => {
mockReadFile.mockResolvedValue(mockContent);
mockFetch.mockResolvedValue({
ok: true,
text: () => mockContent
status: 200,
statusText: 'OK',
headers: {
get: (name: string) => (name === 'content-type' ? 'text/plain' : null)
},
body: new ReadableStream({
start(controller) {
controller.enqueue(new TextEncoder().encode(mockContent));
controller.close();
}
})
} as any);

const uri = new URL('patternfly://docs/test');
Expand Down
Loading
Loading