chore: generate template (#15)

This commit is contained in:
github-actions[bot] 2022-04-11 11:57:50 -05:00 committed by GitHub
parent 616b737d95
commit 61db82ebbb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 31 additions and 31 deletions

View File

@ -19,11 +19,11 @@ void main() {
TestWidgetsFlutterBinding.ensureInitialized(); TestWidgetsFlutterBinding.ensureInitialized();
group('{{#pascalCase}}{{project_name}}{{/pascalCase}}', () { group('{{#pascalCase}}{{project_name}}{{/pascalCase}}', () {
late {{#pascalCase}}{{project_name}}{{/pascalCase}}Platform myPluginPlatform; late {{#pascalCase}}{{project_name}}{{/pascalCase}}Platform {{#camelCase}}{{project_name}}{{/camelCase}}Platform;
setUp(() { setUp(() {
myPluginPlatform = Mock{{#pascalCase}}{{project_name}}{{/pascalCase}}Platform(); {{#camelCase}}{{project_name}}{{/camelCase}}Platform = Mock{{#pascalCase}}{{project_name}}{{/pascalCase}}Platform();
{{#pascalCase}}{{project_name}}{{/pascalCase}}Platform.instance = myPluginPlatform; {{#pascalCase}}{{project_name}}{{/pascalCase}}Platform.instance = {{#camelCase}}{{project_name}}{{/camelCase}}Platform;
}); });
group('getPlatformName', () { group('getPlatformName', () {
@ -31,7 +31,7 @@ void main() {
() async { () async {
const platformName = '__test_platform__'; const platformName = '__test_platform__';
when( when(
() => myPluginPlatform.getPlatformName(), () => {{#camelCase}}{{project_name}}{{/camelCase}}Platform.getPlatformName(),
).thenAnswer((_) async => platformName); ).thenAnswer((_) async => platformName);
final actualPlatformName = await getPlatformName(); final actualPlatformName = await getPlatformName();
@ -41,7 +41,7 @@ void main() {
test('throws exception when platform implementation is missing', test('throws exception when platform implementation is missing',
() async { () async {
when( when(
() => myPluginPlatform.getPlatformName(), () => {{#camelCase}}{{project_name}}{{/camelCase}}Platform.getPlatformName(),
).thenAnswer((_) async => null); ).thenAnswer((_) async => null);
expect(getPlatformName, throwsException); expect(getPlatformName, throwsException);

View File

@ -15,15 +15,15 @@ void main() {
group('{{#pascalCase}}{{project_name}}{{/pascalCase}}Android', () { group('{{#pascalCase}}{{project_name}}{{/pascalCase}}Android', () {
const kPlatformName = 'Android'; const kPlatformName = 'Android';
late {{#pascalCase}}{{project_name}}{{/pascalCase}}Android myPlugin; late {{#pascalCase}}{{project_name}}{{/pascalCase}}Android {{#camelCase}}{{project_name}}{{/camelCase}};
late List<MethodCall> log; late List<MethodCall> log;
setUp(() async { setUp(() async {
myPlugin = {{#pascalCase}}{{project_name}}{{/pascalCase}}Android(); {{#camelCase}}{{project_name}}{{/camelCase}} = {{#pascalCase}}{{project_name}}{{/pascalCase}}Android();
log = <MethodCall>[]; log = <MethodCall>[];
TestDefaultBinaryMessengerBinding.instance!.defaultBinaryMessenger TestDefaultBinaryMessengerBinding.instance!.defaultBinaryMessenger
.setMockMethodCallHandler(myPlugin.methodChannel, (methodCall) async { .setMockMethodCallHandler({{#camelCase}}{{project_name}}{{/camelCase}}.methodChannel, (methodCall) async {
log.add(methodCall); log.add(methodCall);
switch (methodCall.method) { switch (methodCall.method) {
case 'getPlatformName': case 'getPlatformName':
@ -40,7 +40,7 @@ void main() {
}); });
test('getPlatformName returns correct name', () async { test('getPlatformName returns correct name', () async {
final name = await myPlugin.getPlatformName(); final name = await {{#camelCase}}{{project_name}}{{/camelCase}}.getPlatformName();
expect( expect(
log, log,
<Matcher>[isMethodCall('getPlatformName', arguments: null)], <Matcher>[isMethodCall('getPlatformName', arguments: null)],

View File

@ -15,15 +15,15 @@ void main() {
group('{{#pascalCase}}{{project_name}}{{/pascalCase}}IOS', () { group('{{#pascalCase}}{{project_name}}{{/pascalCase}}IOS', () {
const kPlatformName = 'iOS'; const kPlatformName = 'iOS';
late {{#pascalCase}}{{project_name}}{{/pascalCase}}IOS myPlugin; late {{#pascalCase}}{{project_name}}{{/pascalCase}}IOS {{#camelCase}}{{project_name}}{{/camelCase}};
late List<MethodCall> log; late List<MethodCall> log;
setUp(() async { setUp(() async {
myPlugin = {{#pascalCase}}{{project_name}}{{/pascalCase}}IOS(); {{#camelCase}}{{project_name}}{{/camelCase}} = {{#pascalCase}}{{project_name}}{{/pascalCase}}IOS();
log = <MethodCall>[]; log = <MethodCall>[];
TestDefaultBinaryMessengerBinding.instance!.defaultBinaryMessenger TestDefaultBinaryMessengerBinding.instance!.defaultBinaryMessenger
.setMockMethodCallHandler(myPlugin.methodChannel, (methodCall) async { .setMockMethodCallHandler({{#camelCase}}{{project_name}}{{/camelCase}}.methodChannel, (methodCall) async {
log.add(methodCall); log.add(methodCall);
switch (methodCall.method) { switch (methodCall.method) {
case 'getPlatformName': case 'getPlatformName':
@ -40,7 +40,7 @@ void main() {
}); });
test('getPlatformName returns correct name', () async { test('getPlatformName returns correct name', () async {
final name = await myPlugin.getPlatformName(); final name = await {{#camelCase}}{{project_name}}{{/camelCase}}.getPlatformName();
expect( expect(
log, log,
<Matcher>[isMethodCall('getPlatformName', arguments: null)], <Matcher>[isMethodCall('getPlatformName', arguments: null)],

View File

@ -15,15 +15,15 @@ void main() {
group('{{#pascalCase}}{{project_name}}{{/pascalCase}}Linux', () { group('{{#pascalCase}}{{project_name}}{{/pascalCase}}Linux', () {
const kPlatformName = 'Linux'; const kPlatformName = 'Linux';
late {{#pascalCase}}{{project_name}}{{/pascalCase}}Linux myPlugin; late {{#pascalCase}}{{project_name}}{{/pascalCase}}Linux {{#camelCase}}{{project_name}}{{/camelCase}};
late List<MethodCall> log; late List<MethodCall> log;
setUp(() async { setUp(() async {
myPlugin = {{#pascalCase}}{{project_name}}{{/pascalCase}}Linux(); {{#camelCase}}{{project_name}}{{/camelCase}} = {{#pascalCase}}{{project_name}}{{/pascalCase}}Linux();
log = <MethodCall>[]; log = <MethodCall>[];
TestDefaultBinaryMessengerBinding.instance!.defaultBinaryMessenger TestDefaultBinaryMessengerBinding.instance!.defaultBinaryMessenger
.setMockMethodCallHandler(myPlugin.methodChannel, (methodCall) async { .setMockMethodCallHandler({{#camelCase}}{{project_name}}{{/camelCase}}.methodChannel, (methodCall) async {
log.add(methodCall); log.add(methodCall);
switch (methodCall.method) { switch (methodCall.method) {
case 'getPlatformName': case 'getPlatformName':
@ -40,7 +40,7 @@ void main() {
}); });
test('getPlatformName returns correct name', () async { test('getPlatformName returns correct name', () async {
final name = await myPlugin.getPlatformName(); final name = await {{#camelCase}}{{project_name}}{{/camelCase}}.getPlatformName();
expect( expect(
log, log,
<Matcher>[isMethodCall('getPlatformName', arguments: null)], <Matcher>[isMethodCall('getPlatformName', arguments: null)],

View File

@ -15,15 +15,15 @@ void main() {
group('{{#pascalCase}}{{project_name}}{{/pascalCase}}MacOS', () { group('{{#pascalCase}}{{project_name}}{{/pascalCase}}MacOS', () {
const kPlatformName = 'MacOS'; const kPlatformName = 'MacOS';
late {{#pascalCase}}{{project_name}}{{/pascalCase}}MacOS myPlugin; late {{#pascalCase}}{{project_name}}{{/pascalCase}}MacOS {{#camelCase}}{{project_name}}{{/camelCase}};
late List<MethodCall> log; late List<MethodCall> log;
setUp(() async { setUp(() async {
myPlugin = {{#pascalCase}}{{project_name}}{{/pascalCase}}MacOS(); {{#camelCase}}{{project_name}}{{/camelCase}} = {{#pascalCase}}{{project_name}}{{/pascalCase}}MacOS();
log = <MethodCall>[]; log = <MethodCall>[];
TestDefaultBinaryMessengerBinding.instance!.defaultBinaryMessenger TestDefaultBinaryMessengerBinding.instance!.defaultBinaryMessenger
.setMockMethodCallHandler(myPlugin.methodChannel, (methodCall) async { .setMockMethodCallHandler({{#camelCase}}{{project_name}}{{/camelCase}}.methodChannel, (methodCall) async {
log.add(methodCall); log.add(methodCall);
switch (methodCall.method) { switch (methodCall.method) {
case 'getPlatformName': case 'getPlatformName':
@ -40,7 +40,7 @@ void main() {
}); });
test('getPlatformName returns correct name', () async { test('getPlatformName returns correct name', () async {
final name = await myPlugin.getPlatformName(); final name = await {{#camelCase}}{{project_name}}{{/camelCase}}.getPlatformName();
expect( expect(
log, log,
<Matcher>[isMethodCall('getPlatformName', arguments: null)], <Matcher>[isMethodCall('getPlatformName', arguments: null)],

View File

@ -18,11 +18,11 @@ class {{#pascalCase}}{{project_name}}{{/pascalCase}}Mock extends {{#pascalCase}}
void main() { void main() {
TestWidgetsFlutterBinding.ensureInitialized(); TestWidgetsFlutterBinding.ensureInitialized();
group('{{#pascalCase}}{{project_name}}{{/pascalCase}}PlatformInterface', () { group('{{#pascalCase}}{{project_name}}{{/pascalCase}}PlatformInterface', () {
late {{#pascalCase}}{{project_name}}{{/pascalCase}}Platform myPluginPlatform; late {{#pascalCase}}{{project_name}}{{/pascalCase}}Platform {{#camelCase}}{{project_name}}{{/camelCase}}Platform;
setUp(() { setUp(() {
myPluginPlatform = {{#pascalCase}}{{project_name}}{{/pascalCase}}Mock(); {{#camelCase}}{{project_name}}{{/camelCase}}Platform = {{#pascalCase}}{{project_name}}{{/pascalCase}}Mock();
{{#pascalCase}}{{project_name}}{{/pascalCase}}Platform.instance = myPluginPlatform; {{#pascalCase}}{{project_name}}{{/pascalCase}}Platform.instance = {{#camelCase}}{{project_name}}{{/camelCase}}Platform;
}); });
group('getPlatformName', () { group('getPlatformName', () {

View File

@ -14,10 +14,10 @@ void main() {
group('{{#pascalCase}}{{project_name}}{{/pascalCase}}Web', () { group('{{#pascalCase}}{{project_name}}{{/pascalCase}}Web', () {
const kPlatformName = 'Web'; const kPlatformName = 'Web';
late {{#pascalCase}}{{project_name}}{{/pascalCase}}Web myPlugin; late {{#pascalCase}}{{project_name}}{{/pascalCase}}Web {{#camelCase}}{{project_name}}{{/camelCase}};
setUp(() async { setUp(() async {
myPlugin = {{#pascalCase}}{{project_name}}{{/pascalCase}}Web(); {{#camelCase}}{{project_name}}{{/camelCase}} = {{#pascalCase}}{{project_name}}{{/pascalCase}}Web();
}); });
test('can be registered', () { test('can be registered', () {
@ -26,7 +26,7 @@ void main() {
}); });
test('getPlatformName returns correct name', () async { test('getPlatformName returns correct name', () async {
final name = await myPlugin.getPlatformName(); final name = await {{#camelCase}}{{project_name}}{{/camelCase}}.getPlatformName();
expect(name, equals(kPlatformName)); expect(name, equals(kPlatformName));
}); });
}); });

View File

@ -15,15 +15,15 @@ void main() {
group('{{#pascalCase}}{{project_name}}{{/pascalCase}}Windows', () { group('{{#pascalCase}}{{project_name}}{{/pascalCase}}Windows', () {
const kPlatformName = 'Windows'; const kPlatformName = 'Windows';
late {{#pascalCase}}{{project_name}}{{/pascalCase}}Windows myPlugin; late {{#pascalCase}}{{project_name}}{{/pascalCase}}Windows {{#camelCase}}{{project_name}}{{/camelCase}};
late List<MethodCall> log; late List<MethodCall> log;
setUp(() async { setUp(() async {
myPlugin = {{#pascalCase}}{{project_name}}{{/pascalCase}}Windows(); {{#camelCase}}{{project_name}}{{/camelCase}} = {{#pascalCase}}{{project_name}}{{/pascalCase}}Windows();
log = <MethodCall>[]; log = <MethodCall>[];
TestDefaultBinaryMessengerBinding.instance!.defaultBinaryMessenger TestDefaultBinaryMessengerBinding.instance!.defaultBinaryMessenger
.setMockMethodCallHandler(myPlugin.methodChannel, (methodCall) async { .setMockMethodCallHandler({{#camelCase}}{{project_name}}{{/camelCase}}.methodChannel, (methodCall) async {
log.add(methodCall); log.add(methodCall);
switch (methodCall.method) { switch (methodCall.method) {
case 'getPlatformName': case 'getPlatformName':
@ -40,7 +40,7 @@ void main() {
}); });
test('getPlatformName returns correct name', () async { test('getPlatformName returns correct name', () async {
final name = await myPlugin.getPlatformName(); final name = await {{#camelCase}}{{project_name}}{{/camelCase}}.getPlatformName();
expect( expect(
log, log,
<Matcher>[isMethodCall('getPlatformName', arguments: null)], <Matcher>[isMethodCall('getPlatformName', arguments: null)],