Skip to content

Commit

Permalink
test: remove polyfill references from Node adapters (#7294)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDeBoey authored Aug 30, 2023
1 parent 517e40b commit 18f6c38
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
13 changes: 5 additions & 8 deletions packages/remix-architect/__tests__/server-test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import fsp from "node:fs/promises";
import path from "node:path";
import lambdaTester from "lambda-tester";
import { createRequestHandler as createRemixRequestHandler } from "@remix-run/node";
import type { APIGatewayProxyEventV2 } from "aws-lambda";
import {
createRequestHandler as createRemixRequestHandler,
Response as NodeResponse,
} from "@remix-run/node";
import lambdaTester from "lambda-tester";

import {
createRequestHandler,
Expand Down Expand Up @@ -249,14 +246,14 @@ describe("architect createRemixRequest", () => {

describe("sendRemixResponse", () => {
it("handles regular responses", async () => {
let response = new NodeResponse("anything");
let response = new Response("anything");
let result = await sendRemixResponse(response);
expect(result.body).toBe("anything");
});

it("handles resource routes with regular data", async () => {
let json = JSON.stringify({ foo: "bar" });
let response = new NodeResponse(json, {
let response = new Response(json, {
headers: {
"Content-Type": "application/json",
"content-length": json.length.toString(),
Expand All @@ -271,7 +268,7 @@ describe("sendRemixResponse", () => {
it("handles resource routes with binary data", async () => {
let image = await fsp.readFile(path.join(__dirname, "554828.jpeg"));

let response = new NodeResponse(image, {
let response = new Response(image, {
headers: {
"content-type": "image/jpeg",
"content-length": image.length.toString(),
Expand Down
11 changes: 4 additions & 7 deletions packages/remix-express/__tests__/server-test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { Readable } from "node:stream";
import { createRequestHandler as createRemixRequestHandler } from "@remix-run/node";
import express from "express";
import supertest from "supertest";
import { createRequest, createResponse } from "node-mocks-http";
import {
createRequestHandler as createRemixRequestHandler,
Response as NodeResponse,
} from "@remix-run/node";
import { Readable } from "node:stream";
import supertest from "supertest";

import {
createRemixHeaders,
Expand Down Expand Up @@ -103,7 +100,7 @@ describe("express createRequestHandler", () => {
it("handles body as stream", async () => {
mockedCreateRequestHandler.mockImplementation(() => async () => {
let stream = Readable.from("hello world");
return new NodeResponse(stream, { status: 200 }) as unknown as Response;
return new Response(stream, { status: 200 }) as unknown as Response;
});

let request = supertest(createApp());
Expand Down

0 comments on commit 18f6c38

Please sign in to comment.