aboutsummaryrefslogtreecommitdiff
path: root/t/40-response.t
diff options
context:
space:
mode:
authorMatias Linares <matiaslina@gmail.com>2020-09-06 19:38:12 -0300
committerMatias Linares <matiaslina@gmail.com>2020-09-06 19:38:12 -0300
commit80d50c14866f6e58ee57792a383920a7e8a1274a (patch)
tree49e0b5976f74427bb627c88a60b6626d3b20dd13 /t/40-response.t
parentae506f4258324f77b8644459c1cb0c18359d793b (diff)
downloadperl6-matrix-client-80d50c14866f6e58ee57792a383920a7e8a1274a.tar.gz
Add media store config method
Diffstat (limited to 't/40-response.t')
-rw-r--r--t/40-response.t44
1 files changed, 29 insertions, 15 deletions
diff --git a/t/40-response.t b/t/40-response.t
index cc219b2..8bc3569 100644
--- a/t/40-response.t
+++ b/t/40-response.t
@@ -2,24 +2,38 @@ use lib 'lib';
use Test;
use JSON::Fast;
use Matrix::Response;
-plan 7;
+plan 2;
-my $test-file = 'sync.json';
+subtest 'Sync', {
+ plan 7;
+ my $test-file = 'sync.json';
+ my $data;
-unless $test-file.IO.f {
- skip-rest 'Missing sync.json to test';
- exit;
-}
+ if $test-file.IO.f {
+ $data = from-json($test-file.IO.slurp);
+ lives-ok { Matrix::Response::Sync.new($test-file.IO.slurp) }, 'Sync.new accepts Str';
+ lives-ok { Matrix::Response::Sync.new($data) }, 'Sync.new accepts Associative';
-my $data = from-json($test-file.IO.slurp);
+ my $res = Matrix::Response::Sync.new($data);
+ can-ok $res, 'joined-rooms', 'can .joined-rooms';
+ can-ok $res, 'presence', 'can .presence';
-ok $data;
-lives-ok { Matrix::Response::Sync.new($test-file.IO.slurp) };
-lives-ok { Matrix::Response::Sync.new($data) };
+ isa-ok $res.joined-rooms, List, '.joined-rooms returns a List';
+ isa-ok $res.presence, List, '.presence returns a List';
-my $res = Matrix::Response::Sync.new($data);
-can-ok $res, 'joined-rooms';
-can-ok $res, 'presence';
+ } else {
+ skip 'Missing sync.json to test', 7;
+ }
-isa-ok $res.joined-rooms, List;
-isa-ok $res.presence, List;
+};
+
+subtest 'MediaStore', {
+ plan 4;
+ my %config = 'm.upload.size' => 5000;
+ my $config-response = Matrix::Response::MediaStore::Config.new(|%config);
+
+ isa-ok $config-response, Matrix::Response::MediaStore::Config;
+ can-ok $config-response, 'upload-size';
+ isa-ok $config-response.upload-size, Int;
+ is $config-response.upload-size, %config<m.upload.size>, 'correct upload size';
+};