This repository was archived by the owner on Feb 7, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -80,4 +80,35 @@ public function it_returns_the_channel_information()
8080 ],
8181 ], json_decode ($ response ->getContent (), true ));
8282 }
83+
84+ /** @test */
85+ public function it_returns_empty_object_for_no_channels_found ()
86+ {
87+ $ connection = new Connection ();
88+
89+ $ auth_key = 'TestKey ' ;
90+ $ auth_timestamp = time ();
91+ $ auth_version = '1.0 ' ;
92+
93+ $ queryParameters = http_build_query (compact ('auth_key ' , 'auth_timestamp ' , 'auth_version ' ));
94+
95+ $ signature =
96+ "GET \n/apps/1234/channels \n" .
97+ "auth_key= {$ auth_key }" .
98+ "&auth_timestamp= {$ auth_timestamp }" .
99+ "&auth_version= {$ auth_version }" ;
100+
101+ $ auth_signature = hash_hmac ('sha256 ' , $ signature , 'TestSecret ' );
102+
103+ $ request = new Request ('GET ' , "/apps/1234/channels?appId=1234&auth_signature= {$ auth_signature }& {$ queryParameters }" );
104+
105+ $ controller = app (FetchChannelsController::class);
106+
107+ $ controller ->onOpen ($ connection , $ request );
108+
109+ /** @var JsonResponse $response */
110+ $ response = array_pop ($ connection ->sentRawData );
111+
112+ $ this ->assertSame ('{"channels":{}} ' , $ response ->getContent ());
113+ }
83114}
You can’t perform that action at this time.
0 commit comments