Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
brophdawg11 committed Jun 13, 2024
1 parent 4120ae8 commit d207bb1
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions packages/router/__tests__/navigation-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,13 @@ describe("navigations", () => {
})
);
expect(t.router.state.loaderData).toEqual({});
expect(t.router.state.errors).toMatchInlineSnapshot(`
{
"foo": [SyntaxError: Unexpected token } in JSON at position 15],
}
`);

// Node 16/18 versus 20 output different errors here :/
let expected =
process.version.startsWith("v16") || process.version.startsWith("v18")
? "Unexpected token } in JSON at position 15"
: "Unexpected non-whitespace character after JSON at position 15";
expect(t.router.state.errors?.foo).toEqual(new SyntaxError(expected));
});

it("bubbles errors when unwrapping Responses", async () => {
Expand Down Expand Up @@ -204,11 +206,13 @@ describe("navigations", () => {
})
);
expect(t.router.state.loaderData).toEqual({});
expect(t.router.state.errors).toMatchInlineSnapshot(`
{
"root": [SyntaxError: Unexpected token } in JSON at position 15],
}
`);

// Node 16/18 versus 20 output different errors here :/
let expected =
process.version.startsWith("v16") || process.version.startsWith("v18")
? "Unexpected token } in JSON at position 15"
: "Unexpected non-whitespace character after JSON at position 15";
expect(t.router.state.errors?.root).toEqual(new SyntaxError(expected));
});

it("does not fetch unchanging layout data", async () => {
Expand Down

0 comments on commit d207bb1

Please sign in to comment.