Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix polyfill issues and ProxyContext old api usage
  • Loading branch information
BrunoQuaresma committed Mar 14, 2024
commit 41fcf235052998d7d6fa745253be27b47ed3928a
2 changes: 1 addition & 1 deletion site/jest.polyfills.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* you don't want to deal with this.
*/
const { TextDecoder, TextEncoder } = require("node:util");
const { ReadableStream } = require("stream/web");
const { ReadableStream } = require("node:stream/web");

Object.defineProperties(globalThis, {
TextDecoder: { value: TextDecoder },
Expand Down
26 changes: 9 additions & 17 deletions site/src/contexts/ProxyContext.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import "testHelpers/localStorage";
import { screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { http } from "msw";
import { http, HttpResponse } from "msw";
import type { Region } from "api/typesGenerated";
import {
MockPrimaryWorkspaceProxy,
Expand Down Expand Up @@ -352,22 +352,14 @@ describe("ProxyContextSelection", () => {

// Mock the API response
server.use(
http.get("/api/v2/regions", async () => {
return res(
ctx.status(200),
ctx.json({
regions: regions,
}),
);
}),
http.get("/api/v2/workspaceproxies", async () => {
return res(
ctx.status(200),
ctx.json({
regions: regions,
}),
);
}),
http.get("/api/v2/regions", () =>
HttpResponse.json({
regions,
}),
),
http.get("/api/v2/workspaceproxies", async () =>
HttpResponse.json({ regions }),
),
);

TestingComponent();
Expand Down