Skip to content

Commit

Permalink
test(core): add failing test to generatePath, see #6171 (#6172)
Browse files Browse the repository at this point in the history
* test(core): add failing test to generatePath, see #6171

* fix(typo): fix typo on test

* Use the pretty option.

* Pretty in compiled function
  • Loading branch information
sibelius authored and timdorr committed May 25, 2018
1 parent 6ae433a commit 34412fd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions packages/react-router/modules/__tests__/generatePath-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,16 @@ describe("generatePath", () => {
expect(generated).toBe("/");
});
});

describe('simple pattern="/view/:id"', () => {
it("handle = on params", () => {
const pattern = "/view/:id";
const params = { id: "Q29tcGxhaW50OjVhZjFhMDg0MzhjMTk1MThiMTdlOTQ2Yg==" };

const generated = generatePath(pattern, params);
expect(generated).toBe(
"/view/Q29tcGxhaW50OjVhZjFhMDg0MzhjMTk1MThiMTdlOTQ2Yg=="
);
});
});
});
2 changes: 1 addition & 1 deletion packages/react-router/modules/generatePath.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const generatePath = (pattern = "/", params = {}) => {
return pattern;
}
const generator = compileGenerator(pattern);
return generator(params);
return generator(params, { pretty: true });
};

export default generatePath;

0 comments on commit 34412fd

Please sign in to comment.