;
+ "app/routes/set.tsx": js`
+ export function loader() {
+ return new Set([1, 2, 3]);
+ }
+ export default function Set({ loaderData }) {
+ return
{JSON.stringify(Array.from(loaderData.values()))}
;
}
`,
},
@@ -103,16 +96,19 @@ test.afterAll(() => {
// add a good description for what you expect React Router to do 👇🏽
////////////////////////////////////////////////////////////////////////////////
-test("[description of what you expect it to do]", async ({ page }) => {
+test("Maintains correct order of Map objects when hydrating", async ({
+ page,
+}) => {
let app = new PlaywrightFixture(appFixture, page);
// You can test any request your app might get using `fixture`.
- let response = await fixture.requestDocument("/");
- expect(await response.text()).toMatch("pizza");
+ let response = await fixture.requestDocument("/map");
+ expect(await response.text()).toMatch("
[[1,1],[2,2],[3,3]]
");
// If you need to test interactivity use the `app`
- await app.goto("/");
- await app.clickLink("/burgers");
- await page.waitForSelector("text=cheeseburger");
+ await app.goto("/map", true);
+
+ let html = await app.getHtml();
+ expect(html).toMatch("
[[1,1],[2,2],[3,3]]
");
// If you're not sure what's going on, you can "poke" the app, it'll
// automatically open up in your browser for 20 seconds, so be quick!
@@ -121,6 +117,19 @@ test("[description of what you expect it to do]", async ({ page }) => {
// Go check out the other tests to see what else you can do.
});
+test("Maintains correct order of Set objects when hydrating", async ({
+ page,
+}) => {
+ let app = new PlaywrightFixture(appFixture, page);
+ let response = await fixture.requestDocument("/set");
+ expect(await response.text()).toMatch("
[1,2,3]
");
+
+ await app.goto("/set", true);
+
+ let html = await app.getHtml();
+ expect(html).toMatch("
[1,2,3]
");
+});
+
////////////////////////////////////////////////////////////////////////////////
// 💿 Finally, push your changes to your fork of React Router
// and open a pull request!