summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rw-r--r--t/20-client.t35
1 files changed, 34 insertions, 1 deletions
diff --git a/t/20-client.t b/t/20-client.t
index 3fd6739..2215a6b 100644
--- a/t/20-client.t
+++ b/t/20-client.t
@@ -1,7 +1,7 @@
use lib 'lib';
use Test;
use Matrix::Client;
-plan 4;
+plan 5;
unless %*ENV<MATRIX_CLIENT_TEST_SERVER> {
skip-rest 'No test server setted';
@@ -62,3 +62,36 @@ subtest 'sync' => {
isa-ok $client.sync(:sync-filter(room => timeline => limit => 1)),
Matrix::Response::Sync, 'sync wit Hash sync-filter';
}
+
+subtest 'directory' => {
+ plan 6;
+ my $alias = '#testing:localhost';
+ my $test-room = $client.create-room;
+
+ throws-like {
+ $client.get-room-id($alias);
+ }, X::Matrix::Response,
+ message => /M_NOT_FOUND/,
+ "raises with unknown alias";
+
+ lives-ok {
+ $client.add-room-alias($test-room.id, $alias)
+ }, 'can add an alias to the room';
+
+ lives-ok {
+ $client.get-room-id($alias);
+ }, 'can retrieve room with an alias';
+
+ is $client.get-room-id($alias), $test-room.id,
+ 'good room when retrieve';
+
+ lives-ok {
+ $client.remove-room-alias($alias);
+ }, 'can remove the alias';
+
+ throws-like {
+ $client.get-room-id($alias);
+ }, X::Matrix::Response,
+ message => /M_NOT_FOUND/,
+ "Room not found after delete";
+}