Skip to content

Commit b6d8917

Browse files
committed
fix: mock Readable.fromWeb in download tests
1 parent b7d4dd0 commit b6d8917

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

  • x-pack/platform/plugins/shared/sample_data_ingest/server/services/artifact_manager/utils

x-pack/platform/plugins/shared/sample_data_ingest/server/services/artifact_manager/utils/download.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,18 @@ jest.mock('stream/promises', () => ({
3232
pipeline: jest.fn(),
3333
}));
3434

35+
// Mock Readable.fromWeb to return the mock body directly since pipeline is already mocked
36+
jest.mock('stream', () => {
37+
const actual = jest.requireActual('stream');
38+
return {
39+
...actual,
40+
Readable: {
41+
...actual.Readable,
42+
fromWeb: jest.fn((webStream) => webStream),
43+
},
44+
};
45+
});
46+
3547
const fetchMock = jest.spyOn(global, 'fetch');
3648

3749
describe('download', () => {

0 commit comments

Comments
 (0)