2021-10-04 17:41:45 +00:00
|
|
|
import { parsePath } from "./ParsePath"
|
2021-09-29 23:19:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
test("splits empty path", () => {
|
|
|
|
expect(
|
2021-10-04 17:41:45 +00:00
|
|
|
parsePath("/"),
|
2021-09-29 23:19:51 +00:00
|
|
|
).toMatchObject(
|
|
|
|
{}
|
|
|
|
)
|
|
|
|
})
|
|
|
|
|
|
|
|
test("splits instance path", () => {
|
|
|
|
expect(
|
2021-10-04 17:41:45 +00:00
|
|
|
parsePath("/i/https:api:sophon:steffo:eu:"),
|
2021-09-29 23:19:51 +00:00
|
|
|
).toMatchObject(
|
|
|
|
{
|
|
|
|
instance: "https:api:sophon:steffo:eu:"
|
|
|
|
}
|
|
|
|
)
|
|
|
|
})
|
|
|
|
|
|
|
|
test("splits username path", () => {
|
|
|
|
expect(
|
2021-10-04 17:41:45 +00:00
|
|
|
parsePath("/i/https:api:sophon:steffo:eu:/u/steffo"),
|
2021-09-29 23:19:51 +00:00
|
|
|
).toMatchObject(
|
|
|
|
{
|
|
|
|
instance: "https:api:sophon:steffo:eu:",
|
|
|
|
userName: "steffo",
|
|
|
|
}
|
|
|
|
)
|
|
|
|
})
|
|
|
|
|
|
|
|
test("splits userid path", () => {
|
|
|
|
expect(
|
2021-10-04 17:41:45 +00:00
|
|
|
parsePath("/i/https:api:sophon:steffo:eu:/u/1"),
|
2021-09-29 23:19:51 +00:00
|
|
|
).toMatchObject(
|
|
|
|
{
|
|
|
|
instance: "https:api:sophon:steffo:eu:",
|
|
|
|
userId: "1",
|
|
|
|
}
|
|
|
|
)
|
|
|
|
})
|
|
|
|
|
|
|
|
test("splits research group path", () => {
|
|
|
|
expect(
|
2021-10-04 17:41:45 +00:00
|
|
|
parsePath("/i/https:api:sophon:steffo:eu:/g/testers"),
|
2021-09-29 23:19:51 +00:00
|
|
|
).toMatchObject(
|
|
|
|
{
|
|
|
|
instance: "https:api:sophon:steffo:eu:",
|
|
|
|
researchGroup: "testers",
|
|
|
|
}
|
|
|
|
)
|
|
|
|
})
|
|
|
|
|
|
|
|
test("splits research project path", () => {
|
|
|
|
expect(
|
2021-10-04 17:41:45 +00:00
|
|
|
parsePath("/i/https:api:sophon:steffo:eu:/g/testers/p/test"),
|
2021-09-29 23:19:51 +00:00
|
|
|
).toMatchObject(
|
|
|
|
{
|
|
|
|
instance: "https:api:sophon:steffo:eu:",
|
|
|
|
researchGroup: "testers",
|
|
|
|
researchProject: "test",
|
|
|
|
}
|
|
|
|
)
|
|
|
|
})
|
|
|
|
|
|
|
|
test("splits research project path", () => {
|
|
|
|
expect(
|
2021-10-04 17:41:45 +00:00
|
|
|
parsePath("/i/https:api:sophon:steffo:eu:/g/testers/p/test/n/testerino"),
|
2021-09-29 23:19:51 +00:00
|
|
|
).toMatchObject(
|
|
|
|
{
|
|
|
|
instance: "https:api:sophon:steffo:eu:",
|
|
|
|
researchGroup: "testers",
|
|
|
|
researchProject: "test",
|
|
|
|
notebook: "testerino",
|
|
|
|
}
|
|
|
|
)
|
|
|
|
})
|