From 37a81ebb88759dc627a996362e576d2582f10bdb Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Thu, 22 Jul 2021 17:46:28 +0530 Subject: [PATCH] test(localization): add remaining tests Signed-off-by: xsahil03x --- .../test/translations_test.dart | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/packages/stream_chat_localizations/test/translations_test.dart b/packages/stream_chat_localizations/test/translations_test.dart index 31471406..571fec29 100644 --- a/packages/stream_chat_localizations/test/translations_test.dart +++ b/packages/stream_chat_localizations/test/translations_test.dart @@ -161,4 +161,25 @@ void main() { expect(localizations.replyToMessageLabel, isNotNull); }); } + + test('should throw if try to load locale which is not supported', () async { + const locale = Locale('not-supported-locale'); + expect( + GlobalStreamChatLocalizations.delegate.isSupported(locale), + isFalse, + ); + try { + await GlobalStreamChatLocalizations.delegate.load(locale); + } catch (e) { + expect(e, isA()); + } + }); + + test('`.toString`', () { + final supportedLocales = kStreamChatSupportedLanguages; + expect( + GlobalStreamChatLocalizations.delegate.toString(), + 'GlobalStreamChatLocalizations.delegate($supportedLocales locales)', + ); + }); }