From c585975ab788ce01cc06d7c3e0e9929cd4e6829b Mon Sep 17 00:00:00 2001 From: Deven Joshi Date: Wed, 21 Jul 2021 20:05:20 +0530 Subject: [PATCH] added tests --- .../test/src/gradient_avatar_test.dart | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/packages/stream_chat_flutter/test/src/gradient_avatar_test.dart b/packages/stream_chat_flutter/test/src/gradient_avatar_test.dart index e8326d9a..d1bb02fb 100644 --- a/packages/stream_chat_flutter/test/src/gradient_avatar_test.dart +++ b/packages/stream_chat_flutter/test/src/gradient_avatar_test.dart @@ -38,6 +38,66 @@ void main() { }, ); + testWidgets( + 'control special character test', + (WidgetTester tester) async { + final client = MockClient(); + final clientState = MockClientState(); + + when(() => client.state).thenReturn(clientState); + when(() => clientState.user).thenReturn(OwnUser(id: 'user-id')); + + await tester.pumpWidget( + MaterialApp( + home: StreamChat( + client: client, + child: const Scaffold( + body: Center( + child: SizedBox( + width: 50, + height: 50, + child: GradientAvatar(name: 'd123@/d de:\$as', userId: 'demo123'), + ), + ), + ), + ), + ), + ); + + expect(find.byType(GradientAvatar), findsOneWidget); + }, + ); + + testWidgets( + 'control alpha numeric test 2', + (WidgetTester tester) async { + final client = MockClient(); + final clientState = MockClientState(); + + when(() => client.state).thenReturn(clientState); + when(() => clientState.user).thenReturn(OwnUser(id: 'user-id')); + + await tester.pumpWidget( + MaterialApp( + home: StreamChat( + client: client, + child: const Scaffold( + body: Center( + child: SizedBox( + width: 50, + height: 50, + child: GradientAvatar(name: '123@/d \$as', userId: 'demo123'), + ), + ), + ), + ), + ), + ); + + expect(find.byType(GradientAvatar), findsOneWidget); + }, + ); + testGoldens( 'golden test for the name "demo user"', (WidgetTester tester) async {