File: 71restart.t

package info (click to toggle)
libnet-async-matrix-perl 0.19-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 264 kB
  • sloc: perl: 2,595; makefile: 2
file content (71 lines) | stat: -rw-r--r-- 1,412 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/perl

use strict;
use warnings;

use Test::More;
use Test::Async::HTTP 0.02; # ->GET

use lib ".";
use t::Util;

use IO::Async::Loop;
use Net::Async::Matrix;
use Future;

my $matrix = Net::Async::Matrix->new(
   ua => my $ua = Test::Async::HTTP->new,
   server => "localserver.test",

   make_delay => sub { Future->new },
);

IO::Async::Loop->new->add( $matrix ); # for ->loop->new_future
matrix_login( $matrix, $ua );

my $room = matrix_join_room( $matrix, $ua,
   {  type       => "m.room.member",
      room_id    => "!room:localserver.test",
      state_key  => '@sender:localserver.test',
      membership => "join",
   },
);

$matrix->stop;
pass( '$matrix->stop' );

$matrix->start;

my $p = $ua->next_pending;
is( $p->request->uri->path, "/_matrix/client/r0/sync", '$req->uri->path' );

respond_json( $p, {
   next_batch => "next_token_here",
   presence => {
      events => [],
   },
   rooms => {
      join => {
         '!room:localserver.test' => {
            timeline => {
               limited    => '',
               prev_batch => '',
               events     => [],
            },
            state => {
               events => [],
            },
            account_data => {
               events => [],
            },
            ephemeral => {
               events => [],
            },
         },
      }
   },
});

pass( '$matrix->start does not fail' );

done_testing;