Skip to content

Commit 2f2b327

Browse files
committed
Fix route regex in Jest config
1 parent ba212f5 commit 2f2b327

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

binderhub/static/js/App.test.jsx

+8-6
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ test("renders loading page", () => {
3131
expect(screen.queryByText(/Launching your Binder/)).toBeInTheDocument();
3232
});
3333

34-
test("renders loading page with trailign slash", () => {
34+
test("renders loading page with trailing slash", () => {
3535
const { hook } = memoryLocation({ path: "/v2/gh/user/repo/main/" });
3636
render(<App routerHook={hook} />);
3737
expect(screen.queryByText(/Launching your Binder/)).toBeInTheDocument();
@@ -40,9 +40,11 @@ test("renders loading page with trailign slash", () => {
4040
test("renders error for misconfigured repo", () => {
4141
const { hook } = memoryLocation({ path: "/v2/gh/userrep/main/" });
4242
render(<App routerHook={hook} />);
43-
expect(
44-
screen.queryByText(
45-
/Spec for this provider should match .+\/.+\/.+, provided: "userrepo\/main"/,
46-
),
47-
).toBeInTheDocument();
43+
expect(screen.queryByText(/Not Found/)).toBeInTheDocument();
44+
});
45+
46+
test("renders loading page with trailing slash", () => {
47+
const { hook } = memoryLocation({ path: "/v2/zenodo/10.5281/zenodo.3242074/" });
48+
render(<App routerHook={hook} />);
49+
expect(screen.queryByText(/Launching your Binder/)).toBeInTheDocument();
4850
});

setupTests.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ window.pageConfig = {
2727
},
2828
displayName: "GitHub",
2929
id: "gh",
30-
spec: { validateRegex: /.+\/.+\/.+/ },
30+
spec: { validateRegex: ".+\\/.+\\/.+" },
3131
ref: {
3232
default: "HEAD",
3333
enabled: true,
@@ -41,7 +41,7 @@ window.pageConfig = {
4141
{
4242
displayName: "Zenodo DOI",
4343
id: "zenodo",
44-
spec: { validateRegex: /10\.\d+\/(.)+/ },
44+
spec: { validateRegex: "10\\.\\d+\\/(.)+" },
4545
ref: {
4646
enabled: false,
4747
},

0 commit comments

Comments
 (0)