chore: generate template (#17)

This commit is contained in:
github-actions[bot]
2022-04-11 14:18:19 -05:00
committed by GitHub
parent 5baf0dfa61
commit 699457e663
249 changed files with 932 additions and 932 deletions

View File

@@ -0,0 +1,51 @@
// Copyright (c) 2022, Very Good Ventures
// https://verygood.ventures
//
// Use of this source code is governed by an MIT-style
// license that can be found in the LICENSE file or at
// https://opensource.org/licenses/MIT.
import 'package:flutter_test/flutter_test.dart';
import 'package:mocktail/mocktail.dart';
import 'package:{{project_name.snakeCase()}}/{{project_name.snakeCase()}}.dart';
import 'package:{{project_name.snakeCase()}}_platform_interface/{{project_name.snakeCase()}}_platform_interface.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
class Mock{{project_name.pascalCase()}}Platform extends Mock
with MockPlatformInterfaceMixin
implements {{project_name.pascalCase()}}Platform {}
void main() {
TestWidgetsFlutterBinding.ensureInitialized();
group('{{project_name.pascalCase()}}', () {
late {{project_name.pascalCase()}}Platform {{project_name.camelCase()}}Platform;
setUp(() {
{{project_name.camelCase()}}Platform = Mock{{project_name.pascalCase()}}Platform();
{{project_name.pascalCase()}}Platform.instance = {{project_name.camelCase()}}Platform;
});
group('getPlatformName', () {
test('returns correct name when platform implementation exists',
() async {
const platformName = '__test_platform__';
when(
() => {{project_name.camelCase()}}Platform.getPlatformName(),
).thenAnswer((_) async => platformName);
final actualPlatformName = await getPlatformName();
expect(actualPlatformName, equals(platformName));
});
test('throws exception when platform implementation is missing',
() async {
when(
() => {{project_name.camelCase()}}Platform.getPlatformName(),
).thenAnswer((_) async => null);
expect(getPlatformName, throwsException);
});
});
});
}