Skip to content

Commit bd6ea80

Browse files
committed
fix: mock createWriteStream in orchestrator tests
Use mockImplementation() instead of direct assignment to fix 'Cannot set property which has only a getter' error in CI tests.
1 parent 6484114 commit bd6ea80

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

test/ncp-orchestrator.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,18 @@ describe('NCPOrchestrator - Basic Tests', () => {
2222

2323
// Default mock behavior - no files exist
2424
mockFs.existsSync.mockReturnValue(false);
25+
26+
// Mock createWriteStream to return a writable stream
27+
const mockWriteStream = {
28+
write: jest.fn(),
29+
end: jest.fn((callback?: any) => {
30+
if (callback) callback();
31+
}),
32+
on: jest.fn(),
33+
once: jest.fn(),
34+
emit: jest.fn()
35+
};
36+
(mockFs.createWriteStream as jest.Mock).mockImplementation(() => mockWriteStream as any);
2537
});
2638

2739
describe('instantiation', () => {

0 commit comments

Comments
 (0)