Skip to content

Commit 34412fd

Browse files
sibeliustimdorr
authored andcommitted
test(core): add failing test to generatePath, see #6171 (#6172)
* test(core): add failing test to generatePath, see #6171 * fix(typo): fix typo on test * Use the pretty option. * Pretty in compiled function
1 parent 6ae433a commit 34412fd

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

packages/react-router/modules/__tests__/generatePath-test.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,16 @@ describe("generatePath", () => {
5353
expect(generated).toBe("/");
5454
});
5555
});
56+
57+
describe('simple pattern="/view/:id"', () => {
58+
it("handle = on params", () => {
59+
const pattern = "/view/:id";
60+
const params = { id: "Q29tcGxhaW50OjVhZjFhMDg0MzhjMTk1MThiMTdlOTQ2Yg==" };
61+
62+
const generated = generatePath(pattern, params);
63+
expect(generated).toBe(
64+
"/view/Q29tcGxhaW50OjVhZjFhMDg0MzhjMTk1MThiMTdlOTQ2Yg=="
65+
);
66+
});
67+
});
5668
});

packages/react-router/modules/generatePath.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const generatePath = (pattern = "/", params = {}) => {
2828
return pattern;
2929
}
3030
const generator = compileGenerator(pattern);
31-
return generator(params);
31+
return generator(params, { pretty: true });
3232
};
3333

3434
export default generatePath;

0 commit comments

Comments
 (0)