2021-10-04 17:41:45 +00:00
|
|
|
import { parsePath } from "./ParsePath"
|
2021-09-29 23:19:51 +00:00
|
|
|
|
|
|
|
|
2021-11-05 16:55:15 +00:00
|
|
|
test("parses empty path", () => {
|
2021-09-29 23:19:51 +00:00
|
|
|
expect(
|
2021-10-04 17:41:45 +00:00
|
|
|
parsePath("/"),
|
2021-09-29 23:19:51 +00:00
|
|
|
).toMatchObject(
|
|
|
|
{
|
2021-11-08 17:38:30 +00:00
|
|
|
count: 0,
|
|
|
|
valid: true,
|
2021-11-05 16:55:15 +00:00
|
|
|
},
|
2021-09-29 23:19:51 +00:00
|
|
|
)
|
|
|
|
})
|
|
|
|
|
2021-11-08 17:38:30 +00:00
|
|
|
test("parses instance path", () => {
|
2021-09-29 23:19:51 +00:00
|
|
|
expect(
|
2021-11-08 17:38:30 +00:00
|
|
|
parsePath("/i/https:api:sophon:steffo:eu:/"),
|
2021-09-29 23:19:51 +00:00
|
|
|
).toMatchObject(
|
|
|
|
{
|
|
|
|
instance: "https:api:sophon:steffo:eu:",
|
2021-11-08 17:38:30 +00:00
|
|
|
count: 1,
|
|
|
|
valid: true,
|
2021-11-05 16:55:15 +00:00
|
|
|
},
|
2021-09-29 23:19:51 +00:00
|
|
|
)
|
|
|
|
})
|
|
|
|
|
2021-11-08 17:38:30 +00:00
|
|
|
test("parses logged in path", () => {
|
2021-09-29 23:19:51 +00:00
|
|
|
expect(
|
2021-11-08 17:38:30 +00:00
|
|
|
parsePath("/i/https:api:sophon:steffo:eu:/l/logged-in/"),
|
2021-09-29 23:19:51 +00:00
|
|
|
).toMatchObject(
|
|
|
|
{
|
|
|
|
instance: "https:api:sophon:steffo:eu:",
|
2021-11-08 17:38:30 +00:00
|
|
|
loggedIn: "logged-in",
|
|
|
|
count: 2,
|
|
|
|
valid: true,
|
2021-11-05 16:55:15 +00:00
|
|
|
},
|
2021-09-29 23:19:51 +00:00
|
|
|
)
|
|
|
|
})
|
|
|
|
|
2021-11-05 16:55:15 +00:00
|
|
|
test("parses research group path", () => {
|
2021-09-29 23:19:51 +00:00
|
|
|
expect(
|
2021-11-08 17:38:30 +00:00
|
|
|
parsePath("/i/https:api:sophon:steffo:eu:/l/logged-in/g/testers/"),
|
2021-09-29 23:19:51 +00:00
|
|
|
).toMatchObject(
|
|
|
|
{
|
|
|
|
instance: "https:api:sophon:steffo:eu:",
|
2021-11-08 17:38:30 +00:00
|
|
|
loggedIn: "logged-in",
|
2021-09-29 23:19:51 +00:00
|
|
|
researchGroup: "testers",
|
2021-11-08 17:38:30 +00:00
|
|
|
count: 3,
|
|
|
|
valid: true,
|
2021-11-05 16:55:15 +00:00
|
|
|
},
|
2021-09-29 23:19:51 +00:00
|
|
|
)
|
|
|
|
})
|
|
|
|
|
2021-11-05 16:55:15 +00:00
|
|
|
test("parses research project path", () => {
|
2021-09-29 23:19:51 +00:00
|
|
|
expect(
|
2021-11-08 17:38:30 +00:00
|
|
|
parsePath("/i/https:api:sophon:steffo:eu:/l/logged-in/g/testers/p/test/"),
|
2021-09-29 23:19:51 +00:00
|
|
|
).toMatchObject(
|
|
|
|
{
|
|
|
|
instance: "https:api:sophon:steffo:eu:",
|
2021-11-08 17:38:30 +00:00
|
|
|
loggedIn: "logged-in",
|
2021-09-29 23:19:51 +00:00
|
|
|
researchGroup: "testers",
|
|
|
|
researchProject: "test",
|
2021-11-08 17:38:30 +00:00
|
|
|
count: 4,
|
|
|
|
valid: true,
|
2021-11-05 16:55:15 +00:00
|
|
|
},
|
2021-09-29 23:19:51 +00:00
|
|
|
)
|
|
|
|
})
|
|
|
|
|
2021-11-08 17:38:30 +00:00
|
|
|
test("parses notebook path", () => {
|
2021-09-29 23:19:51 +00:00
|
|
|
expect(
|
2021-11-08 17:38:30 +00:00
|
|
|
parsePath("/i/https:api:sophon:steffo:eu:/l/logged-in/g/testers/p/test/n/testerino/"),
|
2021-09-29 23:19:51 +00:00
|
|
|
).toMatchObject(
|
|
|
|
{
|
|
|
|
instance: "https:api:sophon:steffo:eu:",
|
2021-11-08 17:38:30 +00:00
|
|
|
loggedIn: "logged-in",
|
2021-09-29 23:19:51 +00:00
|
|
|
researchGroup: "testers",
|
|
|
|
researchProject: "test",
|
|
|
|
notebook: "testerino",
|
2021-11-08 17:38:30 +00:00
|
|
|
count: 5,
|
|
|
|
valid: true,
|
2021-11-05 16:55:15 +00:00
|
|
|
},
|
2021-09-29 23:19:51 +00:00
|
|
|
)
|
|
|
|
})
|