add platform_detector_test.dart
Signed-off-by: Sahil Kumar <[email protected]>
This commit is contained in:
@@ -0,0 +1,25 @@
|
|||||||
|
@TestOn('linux')
|
||||||
|
import 'package:stream_chat/src/core/platform_detector/platform_detector.dart';
|
||||||
|
import 'package:test/test.dart';
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
test('`.type` should return current platform', () {
|
||||||
|
final type = CurrentPlatform.type;
|
||||||
|
expect(type, PlatformType.linux);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('`.name` should return current platform name', () {
|
||||||
|
final name = CurrentPlatform.name;
|
||||||
|
expect(name, 'linux');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('flags', () {
|
||||||
|
expect(CurrentPlatform.isWeb, isFalse);
|
||||||
|
expect(CurrentPlatform.isIos, isFalse);
|
||||||
|
expect(CurrentPlatform.isLinux, isTrue);
|
||||||
|
expect(CurrentPlatform.isAndroid, isFalse);
|
||||||
|
expect(CurrentPlatform.isMacOS, isFalse);
|
||||||
|
expect(CurrentPlatform.isWindows, isFalse);
|
||||||
|
expect(CurrentPlatform.isFuchsia, isFalse);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -45,11 +45,10 @@ void main() {
|
|||||||
webSocketController.add(invocation.positionalArguments.first);
|
webSocketController.add(invocation.positionalArguments.first);
|
||||||
});
|
});
|
||||||
when(() => webSocketSink.close(any(), any())).thenAnswer(
|
when(() => webSocketSink.close(any(), any())).thenAnswer(
|
||||||
(_) {
|
(_) async {
|
||||||
final res = webSocketController.close();
|
webSocketController.close();
|
||||||
// re-initializing for future events
|
// re-initializing for future events
|
||||||
webSocketController = StreamController<String>.broadcast();
|
webSocketController = StreamController<String>.broadcast();
|
||||||
return res;
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user