Skip to content

Commit 9cd9cb4

Browse files
authored
test: align file-preview tests with #524 and #526 (#527)
* test: align file-preview tests with #524 and #526 Two tests trailed the latest contract changes: - test-file-handlers.js: #526 dropped structuredContent.imageData and carries the image base64 only in structuredContent.content. Update the image/SVG assertions to read content instead of the removed field. - test-markdown-preview.js: #524 tags read_file calls with origin:'ui'. The Test 9 and Test 11 mocks asserted exact read_file args via deepStrictEqual; add origin:'ui' so the full-document reload and the failed-save resync paths match again. No source changes; both were stale tests, not regressions. * Release v0.2.43 Automated release commit with version bump from 0.2.42 to 0.2.43
1 parent 9efa40b commit 9cd9cb4

5 files changed

Lines changed: 10 additions & 11 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@wonderwhy-er/desktop-commander",
3-
"version": "0.2.42",
3+
"version": "0.2.43",
44
"description": "MCP server for terminal operations and file editing",
55
"mcpName": "io.github.wonderwhy-er/desktop-commander",
66
"license": "MIT",

server.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
"url": "https://github.com/wonderwhy-er/DesktopCommanderMCP",
88
"source": "github"
99
},
10-
"version": "0.2.42",
10+
"version": "0.2.43",
1111
"packages": [
1212
{
1313
"registryType": "npm",
1414
"registryBaseUrl": "https://registry.npmjs.org",
1515
"identifier": "@wonderwhy-er/desktop-commander",
16-
"version": "0.2.42",
16+
"version": "0.2.43",
1717
"transport": {
1818
"type": "stdio"
1919
}

src/version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const VERSION = '0.2.42';
1+
export const VERSION = '0.2.43';

test/test-file-handlers.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -333,9 +333,8 @@ async function testReadFilePreviewMetadata() {
333333
assert.ok(typeof imageContentItem.data === 'string' && imageContentItem.data.length > 0, 'Image content item should carry non-empty base64 data');
334334
assert.ok(imageResult.structuredContent, 'Image should include structuredContent');
335335
assert.strictEqual(imageResult.structuredContent.fileType, 'image', 'Image fileType should map to image preview state');
336-
assert.strictEqual(typeof imageResult.structuredContent.imageData, 'string', 'Image structured payload should include imageData');
337-
assert.ok(imageResult.structuredContent.imageData.length > 0, 'Image structured payload should include non-empty imageData');
338-
assert.strictEqual(imageResult.structuredContent.content, imageResult.structuredContent.imageData, 'Image structuredContent should include file content');
336+
assert.strictEqual(typeof imageResult.structuredContent.content, 'string', 'Image structured payload should carry base64 in content');
337+
assert.ok(imageResult.structuredContent.content.length > 0, 'Image structured payload should include non-empty content');
339338
assert.strictEqual(imageResult.structuredContent.mimeType, 'image/png', 'Image structured payload should include mimeType');
340339
assert.strictEqual(imageResult.structuredContent.filePath, IMAGE_FILE, 'Image file path should be present');
341340
assert.strictEqual(imageResult.structuredContent.sourceTool, 'read_file', 'Image preview should preserve source tool');
@@ -349,8 +348,8 @@ async function testReadFilePreviewMetadata() {
349348
assert.ok(svgResult.structuredContent, 'SVG should include structuredContent');
350349
assert.strictEqual(svgResult.structuredContent.fileType, 'image', 'SVG should map to image preview state');
351350
assert.strictEqual(svgResult.structuredContent.mimeType, 'image/svg+xml', 'SVG structured payload should include SVG mimeType');
352-
assert.strictEqual(typeof svgResult.structuredContent.imageData, 'string', 'SVG structured payload should include imageData');
353-
assert.ok(svgResult.structuredContent.imageData.length > 0, 'SVG structured payload should include non-empty imageData');
351+
assert.strictEqual(typeof svgResult.structuredContent.content, 'string', 'SVG structured payload should carry base64 in content');
352+
assert.ok(svgResult.structuredContent.content.length > 0, 'SVG structured payload should include non-empty content');
354353
assert.strictEqual(svgResult.structuredContent.sourceTool, 'read_file', 'SVG preview should preserve source tool');
355354

356355
const writeResult = await handleWriteFile({ path: TEXT_FILE, content: 'written through handler' });

test/test-markdown-preview.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ async function testFailedSaveResyncsEditBaseline() {
219219
}
220220

221221
if (name === 'read_file') {
222-
assert.deepStrictEqual(args, { path: payload.filePath });
222+
assert.deepStrictEqual(args, { path: payload.filePath, origin: 'ui' });
223223
return {
224224
structuredContent: {
225225
fileName: payload.fileName,
@@ -444,7 +444,7 @@ async function testPartialDocumentBecomesNewEditBaseline() {
444444
const controller = createMarkdownController({
445445
callTool: async (name, args) => {
446446
assert.strictEqual(name, 'read_file');
447-
assert.deepStrictEqual(args, { path: partialPayload.filePath, offset: 0, length: 3 });
447+
assert.deepStrictEqual(args, { path: partialPayload.filePath, offset: 0, length: 3, origin: 'ui' });
448448
return {
449449
structuredContent: {
450450
fileName: partialPayload.fileName,

0 commit comments

Comments
 (0)