-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7e804e1
commit 4c6587f
Showing
22 changed files
with
303 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
test/features/cupertino/ui/layout/cupertino_layout_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import 'package:flutter/cupertino.dart'; | ||
|
||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:get_it/get_it.dart'; | ||
import 'package:mocktail/mocktail.dart'; | ||
|
||
import 'package:flutterfly/core/utils/platforms.dart'; | ||
import 'package:flutterfly/features/cupertino/ui/layout/cupertino_layout.dart'; | ||
import 'package:flutterfly/features/cupertino/ui/services/cupertino_service.dart'; | ||
|
||
class MockPlatform extends Mock implements Platform {} | ||
|
||
class MockCupertinoService extends Mock implements CupertinoService {} | ||
|
||
void main() { | ||
group('Title', () { | ||
setUp(() async { | ||
await GetIt.I.reset(); | ||
GetIt.I.registerSingleton<CupertinoService>(MockCupertinoService()); | ||
GetIt.I.registerSingleton<Platform>(Platform()); | ||
}); | ||
|
||
testWidgets('Render widget successfully', (final tester) async { | ||
await tester.runAsync(() async { | ||
final service = GetIt.I.get<CupertinoService>(); | ||
|
||
when(service.isDark).thenReturn(false); | ||
|
||
await tester.pumpWidget(const CupertinoLayout(child: SizedBox())); | ||
|
||
expect(find.byType(CupertinoApp), findsOneWidget); | ||
expect(find.byType(CupertinoPageScaffold), findsOneWidget); | ||
expect(find.byType(CupertinoTabScaffold), findsOneWidget); | ||
expect(find.byType(SizedBox), findsAtLeastNWidgets(3)); | ||
|
||
reset(service); | ||
|
||
when(service.isDark).thenReturn(false); | ||
|
||
await tester.pumpWidget(const CupertinoLayout(child: SizedBox())); | ||
|
||
verify(service.isDark).called(2); | ||
}); | ||
}); | ||
}); | ||
} |
Oops, something went wrong.