Skip to content

Commit

Permalink
fix: mock TransformStream
Browse files Browse the repository at this point in the history
  • Loading branch information
omBratteng committed Jan 23, 2025
1 parent f5648fe commit 218ee51
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/extension/__tests__/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,13 @@ Object.defineProperty(global, 'open', {
value: jest.fn(),
});

Object.defineProperty(global, 'TransformStream', {
writable: true,
value: jest.fn().mockImplementation(() => ({
backpressure: jest.fn(),
readable: jest.fn(),
writable: jest.fn(),
})),
});

structuredCloneJsonPolyfill();
9 changes: 9 additions & 0 deletions packages/shared/__tests__/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ Object.defineProperty(global, 'open', {
value: jest.fn(),
});

Object.defineProperty(global, 'TransformStream', {
writable: true,
value: jest.fn().mockImplementation(() => ({
backpressure: jest.fn(),
readable: jest.fn(),
writable: jest.fn(),
})),
});

jest.mock('next/router', () => ({
useRouter: jest.fn().mockImplementation(
() =>
Expand Down
9 changes: 9 additions & 0 deletions packages/webapp/__tests__/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ Object.defineProperty(global, 'open', {
value: jest.fn(),
});

Object.defineProperty(global, 'TransformStream', {
writable: true,
value: jest.fn().mockImplementation(() => ({
backpressure: jest.fn(),
readable: jest.fn(),
writable: jest.fn(),
})),
});

jest.mock('next/router', () => ({
useRouter: jest.fn().mockImplementation(
() =>
Expand Down

0 comments on commit 218ee51

Please sign in to comment.