TF-3157 Update web socket with background service worker

TF-3157 Stub BroadcastChannel for mobile build
This commit is contained in:
DatDang
2024-09-27 10:42:10 +07:00
committed by Dat H. Pham
parent c4d0c27603
commit 7d59982cc9
16 changed files with 414 additions and 67 deletions
@@ -0,0 +1,44 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:tmail_ui_user/features/push_notification/data/model/web_socket_echo.dart';
void main() {
group('web socket echo test:', () {
group('isValid():', () {
test(
'should return true '
'when json is web socket echo',
() {
// arrange
final json = {
"@type": "Response",
"requestId": "R1",
"methodResponses": [["Core/echo", {}, "c0"]]
};
// act
final result = WebSocketEcho.isValid(json);
// assert
expect(result, true);
});
test(
'should return false '
'when json is not web socket echo',
() {
// arrange
final json = {
"@type": "Response",
"requestId": "R1",
"methodResponses": [["Core/not-echo", {}, "c0"]]
};
// act
final result = WebSocketEcho.isValid(json);
// assert
expect(result, false);
});
});
});
}