fix: fixed tests

This commit is contained in:
Deven Joshi
2021-07-22 12:33:53 +05:30
parent e6e18a405c
commit e8557b96e4
3 changed files with 43 additions and 61 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

@@ -38,67 +38,6 @@ 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 {
@@ -140,4 +79,47 @@ void main() {
await screenMatchesGolden(tester, 'gradient_avatar_1');
},
);
testGoldens(
'control special character test',
(WidgetTester tester) async {
await tester.pumpWidget(
const MaterialApp(
home: Scaffold(
body: Center(
child: SizedBox(
width: 50,
height: 50,
child:
GradientAvatar(name: 'd123@/d de:\$as', userId: 'demo123'),
),
),
),
),
);
await screenMatchesGolden(tester, 'gradient_avatar_2');
},
);
testGoldens(
'control special character test 2',
(WidgetTester tester) async {
await tester.pumpWidget(
const MaterialApp(
home: Scaffold(
body: Center(
child: SizedBox(
width: 50,
height: 50,
child: GradientAvatar(name: '123@/d \$as', userId: 'demo123'),
),
),
),
),
);
await screenMatchesGolden(tester, 'gradient_avatar_3');
},
);
}