@jgardner04/ghost-mcp-server 1.11.0 → 1.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jgardner04/ghost-mcp-server",
3
- "version": "1.11.0",
3
+ "version": "1.12.0",
4
4
  "description": "A Model Context Protocol (MCP) server for interacting with Ghost CMS via the Admin API",
5
5
  "author": "Jonathan Gardner",
6
6
  "type": "module",
@@ -83,15 +83,21 @@ vi.mock('axios', () => ({
83
83
  }));
84
84
 
85
85
  // Mock fs
86
- const mockUnlink = vi.fn((path, cb) => cb(null));
87
86
  const mockCreateWriteStream = vi.fn();
88
87
  vi.mock('fs', () => ({
89
88
  default: {
90
- unlink: (...args) => mockUnlink(...args),
91
89
  createWriteStream: (...args) => mockCreateWriteStream(...args),
92
90
  },
93
91
  }));
94
92
 
93
+ // Mock tempFileManager
94
+ const mockTrackTempFile = vi.fn();
95
+ const mockCleanupTempFiles = vi.fn().mockResolvedValue(undefined);
96
+ vi.mock('../utils/tempFileManager.js', () => ({
97
+ trackTempFile: (...args) => mockTrackTempFile(...args),
98
+ cleanupTempFiles: (...args) => mockCleanupTempFiles(...args),
99
+ }));
100
+
95
101
  // Mock os
96
102
  vi.mock('os', () => ({
97
103
  default: { tmpdir: vi.fn().mockReturnValue('/tmp') },
@@ -251,7 +257,7 @@ describe('mcp_server', () => {
251
257
  const input = { imageUrl: 'https://example.com/image.jpg' };
252
258
  await toolImplementations.ghost_upload_image(input);
253
259
 
254
- expect(mockUnlink).toHaveBeenCalled();
260
+ expect(mockCleanupTempFiles).toHaveBeenCalled();
255
261
  });
256
262
 
257
263
  it('should cleanup temporary files on error', async () => {
@@ -260,7 +266,7 @@ describe('mcp_server', () => {
260
266
  const input = { imageUrl: 'https://example.com/image.jpg' };
261
267
  await expect(toolImplementations.ghost_upload_image(input)).rejects.toThrow();
262
268
 
263
- expect(mockUnlink).toHaveBeenCalled();
269
+ expect(mockCleanupTempFiles).toHaveBeenCalled();
264
270
  });
265
271
 
266
272
  it('should handle download errors', async () => {