Skip to content

Commit

Permalink
Include WebSocket in sandbox, fixes cloudflare#30
Browse files Browse the repository at this point in the history
  • Loading branch information
mrbbot committed Aug 22, 2021
1 parent 1c0ed30 commit 633fedd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/modules/ws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ export class WebSocketsModule extends Module {
MessageEvent,
CloseEvent,
ErrorEvent,
WebSocket,
WebSocketPair,
};
}
Expand Down
3 changes: 2 additions & 1 deletion test/modules/ws.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,10 @@ test("terminateWebSocket: throws if web socket already closed", async (t) => {
});
});

test("buildSandbox: includes WebSocketPair", (t) => {
test("buildSandbox: includes WebSocket and WebSocketPair", (t) => {
const module = new WebSocketsModule(new NoOpLog());
const sandbox = module.buildSandbox();
t.true(typeof sandbox.WebSocket === "function");
t.true(typeof sandbox.WebSocketPair === "function");
});
test("buildSandbox: sends and responds to web socket messages", async (t) => {
Expand Down

0 comments on commit 633fedd

Please sign in to comment.