mirror of
https://github.com/zebrajr/react.git
synced 2025-12-06 12:20:20 +01:00
This uses the richer `serverAct` helper that we already use in other tests. This avoids using the `Scheduler`. We don't use that package on the server so it doesn't make sense to simulate going through it. Additionally, we really should be getting rid of it on the client too to favor `postTask` polyfills.
22 lines
359 B
JavaScript
22 lines
359 B
JavaScript
'use strict';
|
|
|
|
export function patchMessageChannel() {
|
|
global.MessageChannel = class {
|
|
constructor() {
|
|
const port1 = {
|
|
onmesssage: () => {},
|
|
};
|
|
|
|
this.port1 = port1;
|
|
|
|
this.port2 = {
|
|
postMessage(msg) {
|
|
setTimeout(() => {
|
|
port1.onmessage(msg);
|
|
}, 0);
|
|
},
|
|
};
|
|
}
|
|
};
|
|
}
|