feat(app): refactoring of sentry using, feat(become_consultant): fixed possible infinite loading, feat(push_notifications): fixed push navigation from paid plan push

This commit is contained in:
misha
2026-04-07 10:05:11 +03:00
parent b6b13b1db5
commit aac085def4
133 changed files with 2344 additions and 2456 deletions

View File

@@ -1,3 +1,4 @@
import 'package:eatvio_app/core/error_reporting/no_op_error_reporter.dart';
import 'package:eatvio_app/core/app_config.dart';
import 'package:eatvio_app/core/app_initializer.dart';
import 'package:eatvio_app/core/locator_service.dart';
@@ -29,7 +30,7 @@ void main() {
test('initialize returns early when client is not null', () async {
final wsService = MockWsService();
final manager = WsManager(wsService: wsService);
final manager = WsManager(wsService: wsService, errorReporter: const NoOpErrorReporter());
await manager.initialize();
@@ -38,35 +39,35 @@ void main() {
test('newMessagesStream returns null when channel is null', () {
final wsService = MockWsService();
final manager = WsManager(wsService: wsService);
final manager = WsManager(wsService: wsService, errorReporter: const NoOpErrorReporter());
expect(manager.newMessagesStream, isNull);
});
test('newNotificationsStream returns null when channel is null', () {
final wsService = MockWsService();
final manager = WsManager(wsService: wsService);
final manager = WsManager(wsService: wsService, errorReporter: const NoOpErrorReporter());
expect(manager.newNotificationsStream, isNull);
});
test('directChatStream returns null when channel is null', () {
final wsService = MockWsService();
final manager = WsManager(wsService: wsService);
final manager = WsManager(wsService: wsService, errorReporter: const NoOpErrorReporter());
expect(manager.directChatStream, isNull);
});
test('clientTypingStream returns null when channel is null', () {
final wsService = MockWsService();
final manager = WsManager(wsService: wsService);
final manager = WsManager(wsService: wsService, errorReporter: const NoOpErrorReporter());
expect(manager.clientTypingStream, isNull);
});
test('subscribeDirectChatChannel does nothing when channel is null', () {
final wsService = MockWsService();
final manager = WsManager(wsService: wsService);
final manager = WsManager(wsService: wsService, errorReporter: const NoOpErrorReporter());
// Не должно быть исключений
manager.subscribeDirectChatChannel();
@@ -74,7 +75,7 @@ void main() {
test('unsubscribeDirectChatChannel does nothing when channel is null', () {
final wsService = MockWsService();
final manager = WsManager(wsService: wsService);
final manager = WsManager(wsService: wsService, errorReporter: const NoOpErrorReporter());
// Не должно быть исключений
manager.unsubscribeDirectChatChannel();
@@ -82,7 +83,7 @@ void main() {
test('clear sets client and userId to null', () async {
final wsService = MockWsService();
final manager = WsManager(wsService: wsService);
final manager = WsManager(wsService: wsService, errorReporter: const NoOpErrorReporter());
manager.userId = 1;
@@ -94,7 +95,7 @@ void main() {
test('initPrivateDirectChatChannel - создает канал для прямого чата', () async {
final wsService = MockWsService();
final manager = WsManager(wsService: wsService);
final manager = WsManager(wsService: wsService, errorReporter: const NoOpErrorReporter());
const chatId = 'chat-123';
const token = 'test-token';
@@ -109,7 +110,7 @@ void main() {
test('initialize - обрабатывает ошибку при отсутствии токена', () async {
final wsService = MockWsService();
final manager = WsManager(wsService: wsService);
final manager = WsManager(wsService: wsService, errorReporter: const NoOpErrorReporter());
// Убеждаемся, что токена нет
await TokenStorage.removeTokenInStorage();
@@ -122,7 +123,7 @@ void main() {
test('initialize - обрабатывает ошибку при ошибке getWebsocket', () async {
final wsService = MockWsService();
final manager = WsManager(wsService: wsService);
final manager = WsManager(wsService: wsService, errorReporter: const NoOpErrorReporter());
const token = 'test-token';
await TokenStorage.saveTokenInStorage(token);
@@ -136,7 +137,7 @@ void main() {
test('initialize - устанавливает userId из WebsocketInfoModel', () async {
final wsService = MockWsService();
final manager = WsManager(wsService: wsService);
final manager = WsManager(wsService: wsService, errorReporter: const NoOpErrorReporter());
const token = 'test-token';
const userId = 42;
@@ -158,7 +159,7 @@ void main() {
test('clear - отписывается от всех каналов', () async {
final wsService = MockWsService();
final manager = WsManager(wsService: wsService);
final manager = WsManager(wsService: wsService, errorReporter: const NoOpErrorReporter());
manager.userId = 1;
@@ -171,7 +172,7 @@ void main() {
test('initialize - не инициализирует повторно если client уже существует', () async {
final wsService = MockWsService();
final manager = WsManager(wsService: wsService);
final manager = WsManager(wsService: wsService, errorReporter: const NoOpErrorReporter());
const token = 'test-token';
await TokenStorage.saveTokenInStorage(token);
@@ -193,7 +194,7 @@ void main() {
test('subscribeDirectChatChannel - подписывается на канал когда он существует', () {
final wsService = MockWsService();
final manager = WsManager(wsService: wsService);
final manager = WsManager(wsService: wsService, errorReporter: const NoOpErrorReporter());
// Когда канал null, метод не должен выбрасывать исключение
manager.subscribeDirectChatChannel();
@@ -203,7 +204,7 @@ void main() {
test('unsubscribeDirectChatChannel - отписывается от канала когда он существует', () {
final wsService = MockWsService();
final manager = WsManager(wsService: wsService);
final manager = WsManager(wsService: wsService, errorReporter: const NoOpErrorReporter());
// Когда канал null, метод не должен выбрасывать исключение
manager.unsubscribeDirectChatChannel();
@@ -213,35 +214,35 @@ void main() {
test('newMessagesStream - возвращает null когда канал не инициализирован', () {
final wsService = MockWsService();
final manager = WsManager(wsService: wsService);
final manager = WsManager(wsService: wsService, errorReporter: const NoOpErrorReporter());
expect(manager.newMessagesStream, isNull);
});
test('newNotificationsStream - возвращает null когда канал не инициализирован', () {
final wsService = MockWsService();
final manager = WsManager(wsService: wsService);
final manager = WsManager(wsService: wsService, errorReporter: const NoOpErrorReporter());
expect(manager.newNotificationsStream, isNull);
});
test('directChatStream - возвращает null когда канал не инициализирован', () {
final wsService = MockWsService();
final manager = WsManager(wsService: wsService);
final manager = WsManager(wsService: wsService, errorReporter: const NoOpErrorReporter());
expect(manager.directChatStream, isNull);
});
test('clientTypingStream - возвращает null когда канал не инициализирован', () {
final wsService = MockWsService();
final manager = WsManager(wsService: wsService);
final manager = WsManager(wsService: wsService, errorReporter: const NoOpErrorReporter());
expect(manager.clientTypingStream, isNull);
});
test('initialize - обрабатывает случай когда TokenStorage.haveTokenInStorage возвращает false', () async {
final wsService = MockWsService();
final manager = WsManager(wsService: wsService);
final manager = WsManager(wsService: wsService, errorReporter: const NoOpErrorReporter());
// Убеждаемся, что токена нет
await TokenStorage.removeTokenInStorage();