Add tests
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
857f086501
commit
a63fbbf2db
1 changed files with 21 additions and 0 deletions
|
@ -19,6 +19,7 @@ import {
|
||||||
makeGroupPermalink,
|
makeGroupPermalink,
|
||||||
makeRoomPermalink,
|
makeRoomPermalink,
|
||||||
makeUserPermalink,
|
makeUserPermalink,
|
||||||
|
parsePermalink,
|
||||||
RoomPermalinkCreator,
|
RoomPermalinkCreator,
|
||||||
} from "../../../src/utils/permalinks/Permalinks";
|
} from "../../../src/utils/permalinks/Permalinks";
|
||||||
import * as testUtils from "../../test-utils";
|
import * as testUtils from "../../test-utils";
|
||||||
|
@ -450,4 +451,24 @@ describe('Permalinks', function() {
|
||||||
const result = makeGroupPermalink("+community:example.org");
|
const result = makeGroupPermalink("+community:example.org");
|
||||||
expect(result).toBe("https://matrix.to/#/+community:example.org");
|
expect(result).toBe("https://matrix.to/#/+community:example.org");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should correctly parse room permalinks with a via argument', () => {
|
||||||
|
const result = parsePermalink("https://matrix.to/#/!room_id:server?via=some.org");
|
||||||
|
expect(result.roomIdOrAlias).toBe("!room_id:server");
|
||||||
|
expect(result.viaServers).toEqual(["some.org"]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should correctly parse room permalink via arguments', () => {
|
||||||
|
const result = parsePermalink("https://matrix.to/#/!room_id:server?via=foo.bar&via=bar.foo");
|
||||||
|
expect(result.roomIdOrAlias).toBe("!room_id:server");
|
||||||
|
expect(result.viaServers).toEqual(["foo.bar", "bar.foo"]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should correctly parse event permalink via arguments', () => {
|
||||||
|
const result = parsePermalink("https://matrix.to/#/!room_id:server/$event_id/some_thing_here/foobar" +
|
||||||
|
"?via=m1.org&via=m2.org");
|
||||||
|
expect(result.eventId).toBe("$event_id/some_thing_here/foobar");
|
||||||
|
expect(result.roomIdOrAlias).toBe("!room_id:server");
|
||||||
|
expect(result.viaServers).toEqual(["m1.org", "m2.org"]);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue