Files
plezy/test/widgets/companion_remote_discovery_view_test.dart

35 lines
1.2 KiB
Dart
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import 'package:flutter_test/flutter_test.dart';
import 'package:plezy/i18n/strings.g.dart';
import 'package:plezy/services/base_peer_service.dart';
import 'package:plezy/widgets/companion_remote/discovery_view.dart';
void main() {
setUpAll(() => LocaleSettings.setLocaleSync(AppLocale.en));
test('typed peer errors are classified without parsing localized text', () {
expect(
companionRemotePairingErrorMessage(const PeerError(type: PeerErrorType.timeout, message: 'Délai dépassé')),
t.companionRemote.pairing.connectionTimedOut,
);
expect(
companionRemotePairingErrorMessage(const PeerError(type: PeerErrorType.invalidSession, message: 'Sitzung fehlt')),
t.companionRemote.pairing.sessionNotFound,
);
expect(
companionRemotePairingErrorMessage(
const PeerError(type: PeerErrorType.authFailed, message: 'Échec de lauthentification'),
),
t.companionRemote.pairing.authFailed,
);
});
test('typed fallback errors preserve their localized producer message', () {
expect(
companionRemotePairingErrorMessage(
const PeerError(type: PeerErrorType.networkError, message: 'Localized network failure'),
),
'Localized network failure',
);
});
}