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-05 16:55:15 +00:00
|
|
|
{},
|
2021-09-29 23:19:51 +00:00
|
|
|
)
|
|
|
|
})
|
|
|
|
|
2021-11-05 16:55:15 +00:00
|
|
|
test("parses instance path", () => {
|
2021-09-29 23:19:51 +00:00
|
|
|
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(
|
|
|
|
{
|
2021-11-05 16:55:15 +00:00
|
|
|
instance: "https:api:sophon:steffo:eu:",
|
|
|
|
},
|
2021-09-29 23:19:51 +00:00
|
|
|
)
|
|
|
|
})
|
|
|
|
|
2021-11-05 16:55:15 +00:00
|
|
|
test("parses username path", () => {
|
2021-09-29 23:19:51 +00:00
|
|
|
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",
|
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 userid path", () => {
|
2021-09-29 23:19:51 +00:00
|
|
|
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",
|
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-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",
|
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-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",
|
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-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",
|
2021-11-05 16:55:15 +00:00
|
|
|
},
|
2021-09-29 23:19:51 +00:00
|
|
|
)
|
|
|
|
})
|