Skip to content

Commit e2a077a

Browse files
committed
test: use matchers instead of actual values
1 parent 284d0b5 commit e2a077a

File tree

3 files changed

+21
-21
lines changed

3 files changed

+21
-21
lines changed

test/android_test.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ void main() {
3535
expect(
3636
FlutterLauncherIconsConfig.fromJson(flutterIconsConfig)
3737
.isCustomAndroidFile,
38-
false,
38+
isFalse,
3939
);
4040

4141
final Map<String, dynamic> flutterIconsNewIconConfig = <String, dynamic>{
@@ -46,7 +46,7 @@ void main() {
4646
expect(
4747
FlutterLauncherIconsConfig.fromJson(flutterIconsNewIconConfig)
4848
.isCustomAndroidFile,
49-
true,
49+
isTrue,
5050
);
5151
});
5252

@@ -60,7 +60,7 @@ void main() {
6060
expect(
6161
FlutterLauncherIconsConfig.fromJson(flutterIconsNewIconConfig)
6262
.getImagePathAndroid(),
63-
'assets/images/icon-android.png',
63+
equals('assets/images/icon-android.png'),
6464
);
6565
});
6666

test/flutter_launcher_icons_config_test.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,18 +81,18 @@ void main() {
8181
final configs = FlutterLauncherIconsConfig.loadConfigFromPath(path, '.');
8282
expect(configs, isNotNull);
8383
const String imagePath = 'assets/images/icon-710x599.png';
84-
expect(configs!.imagePath, imagePath);
84+
expect(configs!.imagePath, equals(imagePath));
8585
// android configs
8686
expect(configs.android, isTrue);
8787
expect(configs.imagePathAndroid, isNull);
88-
expect(configs.getImagePathAndroid(), imagePath);
88+
expect(configs.getImagePathAndroid(), equals(imagePath));
8989
expect(configs.adaptiveIconBackground, isNull);
9090
expect(configs.adaptiveIconForeground, isNull);
9191
expect(configs.minSdkAndroid, equals(21));
9292
// ios configs
9393
expect(configs.ios, isTrue);
9494
expect(configs.imagePathIOS, isNull);
95-
expect(configs.getImagePathIOS(), imagePath);
95+
expect(configs.getImagePathIOS(), equals(imagePath));
9696
expect(configs.removeAlphaIOS, isFalse);
9797
// web configs
9898
expect(configs.webConfig, isNull);

test/main_test.dart

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import 'package:flutter_launcher_icons/flutter_launcher_icons_config.dart';
66
import 'package:flutter_launcher_icons/ios.dart' as ios;
77
import 'package:flutter_launcher_icons/main.dart' show defaultConfigFile;
88
import 'package:flutter_launcher_icons/main.dart' as main_dart;
9-
import 'package:path/path.dart';
9+
import 'package:path/path.dart' show join;
1010
import 'package:test/test.dart';
1111

1212
// Unit tests for main.dart
@@ -61,7 +61,7 @@ flutter_icons:
6161
final FlutterLauncherIconsConfig? config =
6262
main_dart.loadConfigFileFromArgResults(argResults);
6363
expect(config, isNotNull);
64-
expect(config!.android, true);
64+
expect(config!.android, isTrue);
6565
});
6666
test('default_use_pubspec', () async {
6767
await setCurrentDirectory('pubspec_only');
@@ -74,7 +74,7 @@ flutter_icons:
7474
final FlutterLauncherIconsConfig? config =
7575
main_dart.loadConfigFileFromArgResults(argResults);
7676
expect(config, isNotNull);
77-
expect(config!.ios, false);
77+
expect(config!.ios, isFalse);
7878

7979
// read pubspec if provided file is not found
8080
argResults = parser.parse(<String>['-f', defaultConfigFile]);
@@ -93,7 +93,7 @@ flutter_icons:
9393
final FlutterLauncherIconsConfig? config =
9494
main_dart.loadConfigFileFromArgResults(argResults);
9595
expect(config, isNotNull);
96-
expect(config!.ios, true);
96+
expect(config!.ios, isTrue);
9797

9898
// should fail if no argument
9999
argResults = parser.parse(<String>[]);
@@ -112,15 +112,15 @@ flutter_icons:
112112
'ios': true
113113
};
114114
final config = FlutterLauncherIconsConfig.fromJson(flutterIconsConfig);
115-
expect(config.getImagePathAndroid(), 'assets/images/icon-710x599.png');
116-
expect(config.getImagePathIOS(), 'assets/images/icon-710x599.png');
115+
expect(config.getImagePathAndroid(), equals('assets/images/icon-710x599.png'));
116+
expect(config.getImagePathIOS(), equals('assets/images/icon-710x599.png'));
117117
final Map<String, dynamic> flutterIconsConfigAndroid = <String, dynamic>{
118118
'image_path_android': 'assets/images/icon-710x599.png',
119119
'android': true,
120120
'ios': true
121121
};
122122
final configAndroid = FlutterLauncherIconsConfig.fromJson(flutterIconsConfigAndroid);
123-
expect(configAndroid.getImagePathAndroid(), 'assets/images/icon-710x599.png');
123+
expect(configAndroid.getImagePathAndroid(), equals('assets/images/icon-710x599.png'));
124124
expect(configAndroid.getImagePathIOS(), isNull);
125125
final Map<String, dynamic> flutterIconsConfigBoth = <String, dynamic>{
126126
'image_path_android': 'assets/images/icon-android.png',
@@ -129,8 +129,8 @@ flutter_icons:
129129
'ios': true
130130
};
131131
final configBoth = FlutterLauncherIconsConfig.fromJson(flutterIconsConfigBoth);
132-
expect(configBoth.getImagePathAndroid(), 'assets/images/icon-android.png');
133-
expect(configBoth.getImagePathIOS(), 'assets/images/icon-ios.png');
132+
expect(configBoth.getImagePathAndroid(), equals('assets/images/icon-android.png'));
133+
expect(configBoth.getImagePathIOS(), equals('assets/images/icon-ios.png'));
134134
});
135135

136136
test('At least one platform is in config file', () {
@@ -140,15 +140,15 @@ flutter_icons:
140140
'ios': true
141141
};
142142
final config = FlutterLauncherIconsConfig.fromJson(flutterIconsConfig);
143-
expect(config.hasPlatformConfig, true);
143+
expect(config.hasPlatformConfig, isTrue);
144144
});
145145

146146
test('No platform specified in config', () {
147147
final Map<String, dynamic> flutterIconsConfig = <String, dynamic>{
148148
'image_path': 'assets/images/icon-710x599.png'
149149
};
150150
final config = FlutterLauncherIconsConfig.fromJson(flutterIconsConfig);
151-
expect(config.hasPlatformConfig, false);
151+
expect(config.hasPlatformConfig, isFalse);
152152
});
153153

154154
test('No new Android icon needed - android: false', () {
@@ -158,7 +158,7 @@ flutter_icons:
158158
'ios': true
159159
};
160160
final config = FlutterLauncherIconsConfig.fromJson(flutterIconsConfig);
161-
expect(config.isNeedingNewAndroidIcon, false);
161+
expect(config.isNeedingNewAndroidIcon, isFalse);
162162
});
163163

164164
test('No new Android icon needed - no Android config', () {
@@ -167,7 +167,7 @@ flutter_icons:
167167
'ios': true
168168
};
169169
final config = FlutterLauncherIconsConfig.fromJson(flutterIconsConfig);
170-
expect(config.isNeedingNewAndroidIcon, false);
170+
expect(config.isNeedingNewAndroidIcon, isFalse);
171171
});
172172

173173
test('No new iOS icon needed - ios: false', () {
@@ -177,7 +177,7 @@ flutter_icons:
177177
'ios': false
178178
};
179179
final config = FlutterLauncherIconsConfig.fromJson(flutterIconsConfig);
180-
expect(config.isNeedingNewIOSIcon, false);
180+
expect(config.isNeedingNewIOSIcon, isFalse);
181181
});
182182

183183
test('No new iOS icon needed - no iOS config', () {
@@ -186,6 +186,6 @@ flutter_icons:
186186
'android': true
187187
};
188188
final config = FlutterLauncherIconsConfig.fromJson(flutterIconsConfig);
189-
expect(config.isNeedingNewIOSIcon, false);
189+
expect(config.isNeedingNewIOSIcon, isFalse);
190190
});
191191
}

0 commit comments

Comments
 (0)