Merge branch 'develop' into v4

This commit is contained in:
Salvatore Giordano
2022-01-25 11:40:02 +01:00
24 changed files with 333 additions and 232 deletions
@@ -1,12 +1,10 @@
import 'package:stream_chat/src/core/http/stream_http_client.dart';
import 'package:stream_chat/src/location.dart';
import 'package:test/test.dart';
void main() {
test('should return the all default set params', () {
const options = StreamHttpClientOptions();
expect(options.location, isNull);
expect(options.baseUrl, 'https://chat-us-east-1.stream-io-api.com');
expect(options.baseUrl, 'https://chat.stream-io-api.com');
expect(options.connectTimeout, const Duration(seconds: 6));
expect(options.receiveTimeout, const Duration(seconds: 6));
expect(options.queryParameters, const {});
@@ -21,39 +19,10 @@ void main() {
headers: {'test': 'test'},
queryParameters: {'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.queryParameters, {'123': '123'});
});
group('should create baseUrl according to provided location', () {
test('us-east', () {
const options = StreamHttpClientOptions(location: Location.usEast);
expect(options.location, isNotNull);
expect(options.baseUrl, 'https://chat-proxy-us-east.stream-io-api.com');
});
test('eu-west', () {
const options = StreamHttpClientOptions(location: Location.euWest);
expect(options.location, isNotNull);
expect(options.baseUrl, 'https://chat-proxy-dublin.stream-io-api.com');
});
test('mumbai', () {
const options = StreamHttpClientOptions(location: Location.mumbai);
expect(options.location, isNotNull);
expect(options.baseUrl, 'https://chat-proxy-mumbai.stream-io-api.com');
});
test('sydney', () {
const options = StreamHttpClientOptions(location: Location.sydney);
expect(options.location, isNotNull);
expect(options.baseUrl, 'https://chat-proxy-sydney.stream-io-api.com');
});
test('singapore', () {
const options = StreamHttpClientOptions(location: Location.singapore);
expect(options.location, isNotNull);
expect(options.baseUrl, 'https://chat-proxy-singapore.stream-io-api.com');
});
});
}