From 7b2bf3c4347effb3eadddf87c4f6a6a68b504445 Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Fri, 23 Jul 2021 10:27:47 +0200 Subject: [PATCH] add tests --- .../http/stream_http_client_options_test.dart | 10 ++++++++ .../core/http/stream_http_client_test.dart | 24 ------------------- 2 files changed, 10 insertions(+), 24 deletions(-) diff --git a/packages/stream_chat/test/src/core/http/stream_http_client_options_test.dart b/packages/stream_chat/test/src/core/http/stream_http_client_options_test.dart index a03434fa..ab70462f 100644 --- a/packages/stream_chat/test/src/core/http/stream_http_client_options_test.dart +++ b/packages/stream_chat/test/src/core/http/stream_http_client_options_test.dart @@ -9,6 +9,8 @@ void main() { expect(options.baseUrl, 'https://chat-us-east-1.stream-io-api.com'); expect(options.connectTimeout, const Duration(seconds: 6)); expect(options.receiveTimeout, const Duration(seconds: 6)); + expect(options.queryParams, const {}); + expect(options.headers, const {}); }); test('should override all the default set params', () { @@ -16,11 +18,19 @@ void main() { baseUrl: 'base-url', connectTimeout: Duration(seconds: 3), receiveTimeout: Duration(seconds: 3), + headers: { + 'test': 'test', + }, + queryParams: { + '123': '123', + }, ); expect(options.location, isNull); expect(options.baseUrl, 'base-url'); expect(options.connectTimeout, const Duration(seconds: 3)); expect(options.receiveTimeout, const Duration(seconds: 3)); + expect(options.headers, {'test': 'test'}); + expect(options.queryParams, {'123': '123'}); }); group('should create baseUrl according to provided location', () { diff --git a/packages/stream_chat/test/src/core/http/stream_http_client_test.dart b/packages/stream_chat/test/src/core/http/stream_http_client_test.dart index ab4c4984..af3cabc0 100644 --- a/packages/stream_chat/test/src/core/http/stream_http_client_test.dart +++ b/packages/stream_chat/test/src/core/http/stream_http_client_test.dart @@ -87,30 +87,6 @@ void main() { ); }); - test('loggingInterceptor should log requests', () async { - const apiKey = 'api-key'; - final logger = MockLogger(); - final client = StreamHttpClient(apiKey, logger: logger); - - try { - await client.get('path'); - } catch (_) {} - - verify(() => logger.info(any())).called(16); - }); - - test('loggingInterceptor should log error', () async { - const apiKey = 'api-key'; - final logger = MockLogger(); - final client = StreamHttpClient(apiKey, logger: logger); - - try { - await client.get('path'); - } catch (_) {} - - verify(() => logger.severe(any())).called(8); - }); - test('`.lock` should lock the dio client', () async { final client = StreamHttpClient('api-key'); expect(client.httpClient.interceptors.requestLock.locked, isFalse);