forked from mystiq/hydrogen-web
Add test
Signed-off-by: RMidhunSuresh <hi@midhun.dev>
This commit is contained in:
parent
a54413625e
commit
4f4bc8f805
1 changed files with 22 additions and 0 deletions
|
@ -327,6 +327,28 @@ export function tests() {
|
||||||
assert.equal(segments[4].type, "details");
|
assert.equal(segments[4].type, "details");
|
||||||
assert.equal(segments[4].value, true);
|
assert.equal(segments[4].value, true);
|
||||||
},
|
},
|
||||||
|
"open-room action should only copy over previous segments if there are no parts after open-room": assert => {
|
||||||
|
const nav = new Navigation(allowsChild);
|
||||||
|
const path = nav.pathFrom([
|
||||||
|
new Segment("session", 1),
|
||||||
|
new Segment("rooms", ["a", "b", "c"]),
|
||||||
|
new Segment("room", "b"),
|
||||||
|
new Segment("right-panel", true),
|
||||||
|
new Segment("members", true)
|
||||||
|
]);
|
||||||
|
const segments = parseUrlPath("/session/1/open-room/a/member/foo", path);
|
||||||
|
assert.equal(segments.length, 5);
|
||||||
|
assert.equal(segments[0].type, "session");
|
||||||
|
assert.equal(segments[0].value, "1");
|
||||||
|
assert.equal(segments[1].type, "rooms");
|
||||||
|
assert.deepEqual(segments[1].value, ["a", "b", "c"]);
|
||||||
|
assert.equal(segments[2].type, "room");
|
||||||
|
assert.equal(segments[2].value, "a");
|
||||||
|
assert.equal(segments[3].type, "right-panel");
|
||||||
|
assert.equal(segments[3].value, true);
|
||||||
|
assert.equal(segments[4].type, "member");
|
||||||
|
assert.equal(segments[4].value, "foo");
|
||||||
|
},
|
||||||
"parse open-room action setting a room in an empty tile": assert => {
|
"parse open-room action setting a room in an empty tile": assert => {
|
||||||
const nav = new Navigation(allowsChild);
|
const nav = new Navigation(allowsChild);
|
||||||
const path = nav.pathFrom([
|
const path = nav.pathFrom([
|
||||||
|
|
Loading…
Reference in a new issue