MCPcopy
hub / github.com/remix-run/react-router / runTests

Function runTests

integration/resource-routes-test.ts:176–217  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

174 });
175
176 function runTests() {
177 test("should redirect to redirected", async ({ page }) => {
178 let app = new PlaywrightFixture(appFixture, page);
179 await app.goto("/");
180 await page.click("a[href='/redirect']");
181 await page.waitForSelector("[data-testid='redirected']");
182 });
183
184 test("should handle post to destination", async ({ page }) => {
185 let app = new PlaywrightFixture(appFixture, page);
186 await app.goto("/");
187 await page.click("button[type='submit']");
188 await page.waitForSelector("[data-testid='redirect-destination']");
189 });
190
191 test("should handle reloadDocument to resource route", async ({ page }) => {
192 let app = new PlaywrightFixture(appFixture, page);
193 await app.goto("/data.json");
194 expect(await page.content()).toContain('{"hello":"world"}');
195 });
196
197 test("should handle errors thrown from resource routes", async ({
198 page,
199 }) => {
200 let app = new PlaywrightFixture(appFixture, page);
201 let res = await app.goto("/throw-error");
202 expect(res.status()).toBe(500);
203 expect(await res.text()).toEqual(
204 "Unexpected Server Error\n\nError: Oh noes!",
205 );
206 });
207
208 test("should let loader throw to it's own boundary without a default export", async ({
209 page,
210 }) => {
211 let app = new PlaywrightFixture(appFixture, page);
212 await app.goto("/", true);
213 await app.clickLink("/some-404-path");
214 let html = await app.getHtml();
215 expect(html).toMatch("404 /some-404-path not found");
216 });
217 }
218
219 test("should handle responses returned from resource routes", async ({
220 page,

Callers 1

Calls 3

gotoMethod · 0.95
clickLinkMethod · 0.95
getHtmlMethod · 0.95

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…