Skip to content

Commit

Permalink
chore: remove assert flow (#4554)
Browse files Browse the repository at this point in the history
chore: update tests to handle no assert flow
  • Loading branch information
jacob-ebey committed Nov 9, 2022
1 parent 3829f50 commit b944b7c
Show file tree
Hide file tree
Showing 5 changed files with 161 additions and 210 deletions.
11 changes: 8 additions & 3 deletions integration/error-boundary-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ test.describe("ErrorBoundary", () => {
throw new Error("Kaboom!")
}
export function ErrorBoundary() {
return <p>${OWN_BOUNDARY_TEXT}</p>
return <p id="own-boundary">${OWN_BOUNDARY_TEXT}</p>
}
export default function () {
return (
Expand Down Expand Up @@ -146,7 +146,7 @@ test.describe("ErrorBoundary", () => {
throw new Error("Kaboom!")
}
export function ErrorBoundary() {
return <div>${OWN_BOUNDARY_TEXT}</div>
return <div id="own-boundary">${OWN_BOUNDARY_TEXT}</div>
}
export default function () {
return <div/>
Expand Down Expand Up @@ -176,7 +176,7 @@ test.describe("ErrorBoundary", () => {
}
export function ErrorBoundary() {
return <div>${OWN_BOUNDARY_TEXT}</div>
return <div id="own-boundary">${OWN_BOUNDARY_TEXT}</div>
}
`,

Expand Down Expand Up @@ -305,6 +305,7 @@ test.describe("ErrorBoundary", () => {
let app = new PlaywrightFixture(appFixture, page);
await app.goto("/");
await app.clickSubmitButton(HAS_BOUNDARY_ACTION);
await page.waitForSelector("#own-boundary");
expect(await app.getHtml("main")).toMatch(OWN_BOUNDARY_TEXT);
});

Expand All @@ -314,6 +315,7 @@ test.describe("ErrorBoundary", () => {
let app = new PlaywrightFixture(appFixture, page);
await app.goto(HAS_BOUNDARY_ACTION);
await app.clickSubmitButton(HAS_BOUNDARY_ACTION);
await page.waitForSelector("#own-boundary");
expect(await app.getHtml("main")).toMatch(OWN_BOUNDARY_TEXT);
});

Expand Down Expand Up @@ -589,6 +591,7 @@ test.describe("ErrorBoundary", () => {
let app = new PlaywrightFixture(appFixture, page);
await app.goto("/");
await app.clickSubmitButton(NO_ROOT_BOUNDARY_ACTION);
await page.waitForSelector(`text=${INTERNAL_ERROR_BOUNDARY_HEADING}`)
expect(await app.getHtml("h1")).toMatch(INTERNAL_ERROR_BOUNDARY_HEADING);
});

Expand All @@ -604,6 +607,7 @@ test.describe("ErrorBoundary", () => {
let app = new PlaywrightFixture(appFixture, page);
await app.goto("/");
await app.clickLink(NO_ROOT_BOUNDARY_LOADER_RETURN);
await page.waitForSelector(`text=${INTERNAL_ERROR_BOUNDARY_HEADING}`)
expect(await app.getHtml("h1")).toMatch(INTERNAL_ERROR_BOUNDARY_HEADING);
});

Expand All @@ -621,6 +625,7 @@ test.describe("ErrorBoundary", () => {
let app = new PlaywrightFixture(appFixture, page);
await app.goto("/");
await app.clickSubmitButton(NO_ROOT_BOUNDARY_ACTION_RETURN);
await page.waitForSelector(`text=${INTERNAL_ERROR_BOUNDARY_HEADING}`)
expect(await app.getHtml("h1")).toMatch(INTERNAL_ERROR_BOUNDARY_HEADING);
});
});
Expand Down
5 changes: 0 additions & 5 deletions integration/error-data-request-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import { test, expect } from "@playwright/test";
import { createAppFixture, createFixture, js } from "./helpers/create-fixture";
import type { Fixture, AppFixture } from "./helpers/create-fixture";

const ENABLE_REMIX_ROUTER = !!process.env.ENABLE_REMIX_ROUTER;

test.describe("ErrorBoundary", () => {
let fixture: Fixture;
let appFixture: AppFixture;
Expand Down Expand Up @@ -105,9 +103,6 @@ test.describe("ErrorBoundary", () => {

function assertConsoleError(str: string) {
expect(errorLogs[0]).toEqual(str);
if (ENABLE_REMIX_ROUTER) {
expect(errorLogs[1]).toEqual(str);
}
}

test("returns a 405 x-remix-error on a data fetch to a path with no loader", async () => {
Expand Down
4 changes: 2 additions & 2 deletions integration/transition-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ test.describe("rendering", () => {
await page.waitForLoadState("networkidle");

expect(
responses.map((res) => new URL(res.url()).searchParams.get("_data"))
).toEqual([`routes/${PAGE}`, `routes/${PAGE}/index`]);
responses.map((res) => new URL(res.url()).searchParams.get("_data")).sort()
).toEqual([`routes/${PAGE}`, `routes/${PAGE}/index`].sort());

await page.waitForSelector(`h2:has-text("${PAGE_TEXT}")`);
await page.waitForSelector(`h3:has-text("${PAGE_INDEX_TEXT}")`);
Expand Down
3 changes: 1 addition & 2 deletions packages/remix-server-runtime/__tests__/server-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import { ServerMode } from "../mode";
import type { ServerBuild } from "../build";
import { mockServerBuild } from "./utils";

const ENABLE_REMIX_ROUTER = !!process.env.ENABLE_REMIX_ROUTER;
const DATA_CALL_MULTIPIER = ENABLE_REMIX_ROUTER ? 2 : 1;
const DATA_CALL_MULTIPIER = 1;

function spyConsole() {
// https://github.com/facebook/react/issues/7047
Expand Down
Loading

0 comments on commit b944b7c

Please sign in to comment.