diff --git a/t/basic.t b/t/basic.t index 1a5e0f2ae2179fe5cac5ab7308c40b4bad0cc22a..5c374c276b95cda96a0669d8ae5c644ea162c2d3 100644 --- a/t/basic.t +++ b/t/basic.t @@ -4,7 +4,7 @@ use Test::More; use Test::Mojo; my $t = Test::Mojo->new('CF'); -$t->get_ok('/api.html')->status_is(200)->content_like(qr/CF Online/i); + $t->get_ok('/api.json')->status_is(200) ->json_is('/openapi' => '3.0.3') ->json_is('/info/title' => 'CF Online') diff --git a/t/ws.t b/t/ws.t new file mode 100644 index 0000000000000000000000000000000000000000..94136a69026e960584b5a2ffb1c6d546eb39e7c4 --- /dev/null +++ b/t/ws.t @@ -0,0 +1,17 @@ +use Mojo::Base -strict; + +use Test::More; +use Test::Mojo; + +my $t = Test::Mojo->new('CF'); + +# Test JSON web service +$t->websocket_ok('/ws') + ->send_ok({json => {event => 'KEEPALIVE'}}) + ->message_ok + ->json_message_is('/event' => 'online_users_updated') + ->json_message_has('/payload/all') + ->finish_ok; +; + +done_testing();