chore: generate template (#15)
This commit is contained in:
parent
616b737d95
commit
61db82ebbb
@ -19,11 +19,11 @@ void main() {
|
||||
TestWidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
group('{{#pascalCase}}{{project_name}}{{/pascalCase}}', () {
|
||||
late {{#pascalCase}}{{project_name}}{{/pascalCase}}Platform myPluginPlatform;
|
||||
late {{#pascalCase}}{{project_name}}{{/pascalCase}}Platform {{#camelCase}}{{project_name}}{{/camelCase}}Platform;
|
||||
|
||||
setUp(() {
|
||||
myPluginPlatform = Mock{{#pascalCase}}{{project_name}}{{/pascalCase}}Platform();
|
||||
{{#pascalCase}}{{project_name}}{{/pascalCase}}Platform.instance = myPluginPlatform;
|
||||
{{#camelCase}}{{project_name}}{{/camelCase}}Platform = Mock{{#pascalCase}}{{project_name}}{{/pascalCase}}Platform();
|
||||
{{#pascalCase}}{{project_name}}{{/pascalCase}}Platform.instance = {{#camelCase}}{{project_name}}{{/camelCase}}Platform;
|
||||
});
|
||||
|
||||
group('getPlatformName', () {
|
||||
@ -31,7 +31,7 @@ void main() {
|
||||
() async {
|
||||
const platformName = '__test_platform__';
|
||||
when(
|
||||
() => myPluginPlatform.getPlatformName(),
|
||||
() => {{#camelCase}}{{project_name}}{{/camelCase}}Platform.getPlatformName(),
|
||||
).thenAnswer((_) async => platformName);
|
||||
|
||||
final actualPlatformName = await getPlatformName();
|
||||
@ -41,7 +41,7 @@ void main() {
|
||||
test('throws exception when platform implementation is missing',
|
||||
() async {
|
||||
when(
|
||||
() => myPluginPlatform.getPlatformName(),
|
||||
() => {{#camelCase}}{{project_name}}{{/camelCase}}Platform.getPlatformName(),
|
||||
).thenAnswer((_) async => null);
|
||||
|
||||
expect(getPlatformName, throwsException);
|
||||
|
@ -15,15 +15,15 @@ void main() {
|
||||
|
||||
group('{{#pascalCase}}{{project_name}}{{/pascalCase}}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;
|
||||
|
||||
setUp(() async {
|
||||
myPlugin = {{#pascalCase}}{{project_name}}{{/pascalCase}}Android();
|
||||
{{#camelCase}}{{project_name}}{{/camelCase}} = {{#pascalCase}}{{project_name}}{{/pascalCase}}Android();
|
||||
|
||||
log = <MethodCall>[];
|
||||
TestDefaultBinaryMessengerBinding.instance!.defaultBinaryMessenger
|
||||
.setMockMethodCallHandler(myPlugin.methodChannel, (methodCall) async {
|
||||
.setMockMethodCallHandler({{#camelCase}}{{project_name}}{{/camelCase}}.methodChannel, (methodCall) async {
|
||||
log.add(methodCall);
|
||||
switch (methodCall.method) {
|
||||
case 'getPlatformName':
|
||||
@ -40,7 +40,7 @@ void main() {
|
||||
});
|
||||
|
||||
test('getPlatformName returns correct name', () async {
|
||||
final name = await myPlugin.getPlatformName();
|
||||
final name = await {{#camelCase}}{{project_name}}{{/camelCase}}.getPlatformName();
|
||||
expect(
|
||||
log,
|
||||
<Matcher>[isMethodCall('getPlatformName', arguments: null)],
|
||||
|
@ -15,15 +15,15 @@ void main() {
|
||||
|
||||
group('{{#pascalCase}}{{project_name}}{{/pascalCase}}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;
|
||||
|
||||
setUp(() async {
|
||||
myPlugin = {{#pascalCase}}{{project_name}}{{/pascalCase}}IOS();
|
||||
{{#camelCase}}{{project_name}}{{/camelCase}} = {{#pascalCase}}{{project_name}}{{/pascalCase}}IOS();
|
||||
|
||||
log = <MethodCall>[];
|
||||
TestDefaultBinaryMessengerBinding.instance!.defaultBinaryMessenger
|
||||
.setMockMethodCallHandler(myPlugin.methodChannel, (methodCall) async {
|
||||
.setMockMethodCallHandler({{#camelCase}}{{project_name}}{{/camelCase}}.methodChannel, (methodCall) async {
|
||||
log.add(methodCall);
|
||||
switch (methodCall.method) {
|
||||
case 'getPlatformName':
|
||||
@ -40,7 +40,7 @@ void main() {
|
||||
});
|
||||
|
||||
test('getPlatformName returns correct name', () async {
|
||||
final name = await myPlugin.getPlatformName();
|
||||
final name = await {{#camelCase}}{{project_name}}{{/camelCase}}.getPlatformName();
|
||||
expect(
|
||||
log,
|
||||
<Matcher>[isMethodCall('getPlatformName', arguments: null)],
|
||||
|
@ -15,15 +15,15 @@ void main() {
|
||||
|
||||
group('{{#pascalCase}}{{project_name}}{{/pascalCase}}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;
|
||||
|
||||
setUp(() async {
|
||||
myPlugin = {{#pascalCase}}{{project_name}}{{/pascalCase}}Linux();
|
||||
{{#camelCase}}{{project_name}}{{/camelCase}} = {{#pascalCase}}{{project_name}}{{/pascalCase}}Linux();
|
||||
|
||||
log = <MethodCall>[];
|
||||
TestDefaultBinaryMessengerBinding.instance!.defaultBinaryMessenger
|
||||
.setMockMethodCallHandler(myPlugin.methodChannel, (methodCall) async {
|
||||
.setMockMethodCallHandler({{#camelCase}}{{project_name}}{{/camelCase}}.methodChannel, (methodCall) async {
|
||||
log.add(methodCall);
|
||||
switch (methodCall.method) {
|
||||
case 'getPlatformName':
|
||||
@ -40,7 +40,7 @@ void main() {
|
||||
});
|
||||
|
||||
test('getPlatformName returns correct name', () async {
|
||||
final name = await myPlugin.getPlatformName();
|
||||
final name = await {{#camelCase}}{{project_name}}{{/camelCase}}.getPlatformName();
|
||||
expect(
|
||||
log,
|
||||
<Matcher>[isMethodCall('getPlatformName', arguments: null)],
|
||||
|
@ -15,15 +15,15 @@ void main() {
|
||||
|
||||
group('{{#pascalCase}}{{project_name}}{{/pascalCase}}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;
|
||||
|
||||
setUp(() async {
|
||||
myPlugin = {{#pascalCase}}{{project_name}}{{/pascalCase}}MacOS();
|
||||
{{#camelCase}}{{project_name}}{{/camelCase}} = {{#pascalCase}}{{project_name}}{{/pascalCase}}MacOS();
|
||||
|
||||
log = <MethodCall>[];
|
||||
TestDefaultBinaryMessengerBinding.instance!.defaultBinaryMessenger
|
||||
.setMockMethodCallHandler(myPlugin.methodChannel, (methodCall) async {
|
||||
.setMockMethodCallHandler({{#camelCase}}{{project_name}}{{/camelCase}}.methodChannel, (methodCall) async {
|
||||
log.add(methodCall);
|
||||
switch (methodCall.method) {
|
||||
case 'getPlatformName':
|
||||
@ -40,7 +40,7 @@ void main() {
|
||||
});
|
||||
|
||||
test('getPlatformName returns correct name', () async {
|
||||
final name = await myPlugin.getPlatformName();
|
||||
final name = await {{#camelCase}}{{project_name}}{{/camelCase}}.getPlatformName();
|
||||
expect(
|
||||
log,
|
||||
<Matcher>[isMethodCall('getPlatformName', arguments: null)],
|
||||
|
@ -18,11 +18,11 @@ class {{#pascalCase}}{{project_name}}{{/pascalCase}}Mock extends {{#pascalCase}}
|
||||
void main() {
|
||||
TestWidgetsFlutterBinding.ensureInitialized();
|
||||
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(() {
|
||||
myPluginPlatform = {{#pascalCase}}{{project_name}}{{/pascalCase}}Mock();
|
||||
{{#pascalCase}}{{project_name}}{{/pascalCase}}Platform.instance = myPluginPlatform;
|
||||
{{#camelCase}}{{project_name}}{{/camelCase}}Platform = {{#pascalCase}}{{project_name}}{{/pascalCase}}Mock();
|
||||
{{#pascalCase}}{{project_name}}{{/pascalCase}}Platform.instance = {{#camelCase}}{{project_name}}{{/camelCase}}Platform;
|
||||
});
|
||||
|
||||
group('getPlatformName', () {
|
||||
|
@ -14,10 +14,10 @@ void main() {
|
||||
|
||||
group('{{#pascalCase}}{{project_name}}{{/pascalCase}}Web', () {
|
||||
const kPlatformName = 'Web';
|
||||
late {{#pascalCase}}{{project_name}}{{/pascalCase}}Web myPlugin;
|
||||
late {{#pascalCase}}{{project_name}}{{/pascalCase}}Web {{#camelCase}}{{project_name}}{{/camelCase}};
|
||||
|
||||
setUp(() async {
|
||||
myPlugin = {{#pascalCase}}{{project_name}}{{/pascalCase}}Web();
|
||||
{{#camelCase}}{{project_name}}{{/camelCase}} = {{#pascalCase}}{{project_name}}{{/pascalCase}}Web();
|
||||
});
|
||||
|
||||
test('can be registered', () {
|
||||
@ -26,7 +26,7 @@ void main() {
|
||||
});
|
||||
|
||||
test('getPlatformName returns correct name', () async {
|
||||
final name = await myPlugin.getPlatformName();
|
||||
final name = await {{#camelCase}}{{project_name}}{{/camelCase}}.getPlatformName();
|
||||
expect(name, equals(kPlatformName));
|
||||
});
|
||||
});
|
||||
|
@ -15,15 +15,15 @@ void main() {
|
||||
|
||||
group('{{#pascalCase}}{{project_name}}{{/pascalCase}}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;
|
||||
|
||||
setUp(() async {
|
||||
myPlugin = {{#pascalCase}}{{project_name}}{{/pascalCase}}Windows();
|
||||
{{#camelCase}}{{project_name}}{{/camelCase}} = {{#pascalCase}}{{project_name}}{{/pascalCase}}Windows();
|
||||
|
||||
log = <MethodCall>[];
|
||||
TestDefaultBinaryMessengerBinding.instance!.defaultBinaryMessenger
|
||||
.setMockMethodCallHandler(myPlugin.methodChannel, (methodCall) async {
|
||||
.setMockMethodCallHandler({{#camelCase}}{{project_name}}{{/camelCase}}.methodChannel, (methodCall) async {
|
||||
log.add(methodCall);
|
||||
switch (methodCall.method) {
|
||||
case 'getPlatformName':
|
||||
@ -40,7 +40,7 @@ void main() {
|
||||
});
|
||||
|
||||
test('getPlatformName returns correct name', () async {
|
||||
final name = await myPlugin.getPlatformName();
|
||||
final name = await {{#camelCase}}{{project_name}}{{/camelCase}}.getPlatformName();
|
||||
expect(
|
||||
log,
|
||||
<Matcher>[isMethodCall('getPlatformName', arguments: null)],
|
||||
|
Reference in New Issue
Block a user