Skip to content

Commit

Permalink
chore: Fixes typo in unit tests
Browse files Browse the repository at this point in the history
replaces 'invlaidfliConfigTemplate' for 'invalidfliConfigTemplate'

Signed-off-by: Hugo Branco <[email protected]>
  • Loading branch information
hugobrancowb authored and MarkOSullivan94 committed Oct 31, 2022
1 parent 882ee22 commit 48899bc
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 11 deletions.
40 changes: 30 additions & 10 deletions test/flutter_launcher_icons_config_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@ void main() {
setUpAll(() async {
await d.dir('fli_test', [
d.file('flutter_launcher_icons.yaml', templates.fliConfigTemplate),
d.file('invalid_fli_config.yaml', templates.invlaidfliConfigTemplate),
d.file('invalid_fli_config.yaml', templates.invalidfliConfigTemplate),
]).create();
});
test('should return valid configs', () {
final configs = FlutterLauncherIconsConfig.loadConfigFromPath('flutter_launcher_icons.yaml', prefixPath);
final configs = FlutterLauncherIconsConfig.loadConfigFromPath(
'flutter_launcher_icons.yaml',
prefixPath,
);
expect(configs, isNotNull);
// android configs
expect(configs!.android, isTrue);
Expand Down Expand Up @@ -75,21 +78,28 @@ void main() {
});

test('should return null when invalid filePath is given', () {
final configs = FlutterLauncherIconsConfig.loadConfigFromPath('file_that_dont_exist.yaml', prefixPath);
final configs = FlutterLauncherIconsConfig.loadConfigFromPath(
'file_that_dont_exist.yaml',
prefixPath,
);
expect(configs, isNull);
});

test('should throw InvalidConfigException when config is invalid', () {
expect(
() => FlutterLauncherIconsConfig.loadConfigFromPath('invalid_fli_config.yaml', prefixPath),
() => FlutterLauncherIconsConfig.loadConfigFromPath(
'invalid_fli_config.yaml',
prefixPath,
),
throwsA(isA<InvalidConfigException>()),
);
});
});
group('#loadConfigFromTestPubSpec', () {
test('should return valid configs', () {
const String path = 'test/config/test_pubspec.yaml';
final configs = FlutterLauncherIconsConfig.loadConfigFromPath(path, '.');
final configs =
FlutterLauncherIconsConfig.loadConfigFromPath(path, '.');
expect(configs, isNotNull);
const String imagePath = 'assets/images/icon-710x599.png';
expect(configs!.imagePath, equals(imagePath));
Expand Down Expand Up @@ -118,11 +128,12 @@ void main() {
await d.dir('fli_test', [
d.file('pubspec.yaml', templates.pubspecTemplate),
d.file('flutter_launcher_icons.yaml', templates.fliConfigTemplate),
d.file('invalid_fli_config.yaml', templates.invlaidfliConfigTemplate),
d.file('invalid_fli_config.yaml', templates.invalidfliConfigTemplate),
]).create();
});
test('should return valid configs', () {
final configs = FlutterLauncherIconsConfig.loadConfigFromPubSpec(prefixPath);
final configs =
FlutterLauncherIconsConfig.loadConfigFromPubSpec(prefixPath);
expect(configs, isNotNull);
// android configs
expect(configs!.android, isTrue);
Expand Down Expand Up @@ -181,7 +192,10 @@ void main() {
await d.dir('fli_test', [
d.file('pubspec.yaml', templates.invalidPubspecTemplate),
d.file('flutter_launcher_icons.yaml', templates.fliConfigTemplate),
d.file('invalid_fli_config.yaml', templates.invlaidfliConfigTemplate),
d.file(
'invalid_fli_config.yaml',
templates.invalidfliConfigTemplate,
),
]).create();
});
test('InvalidConfigException when config is invalid', () {
Expand All @@ -195,11 +209,17 @@ void main() {
group('#loadConfigFromFlavor', () {
setUpAll(() async {
await d.dir('fli_test', [
d.file('flutter_launcher_icons-development.yaml', templates.flavorFLIConfigTemplate),
d.file(
'flutter_launcher_icons-development.yaml',
templates.flavorFLIConfigTemplate,
),
]).create();
});
test('should return valid config', () {
final configs = FlutterLauncherIconsConfig.loadConfigFromFlavor('development', prefixPath);
final configs = FlutterLauncherIconsConfig.loadConfigFromFlavor(
'development',
prefixPath,
);
expect(configs, isNotNull);
expect(configs!.android, isTrue);
expect(configs.imagePath, isNotNull);
Expand Down
2 changes: 1 addition & 1 deletion test/templates.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ flutter_icons:
icon_size: 258
''';

const invlaidfliConfigTemplate = r'''
const invalidfliConfigTemplate = r'''
# flutter_icons
android: true
ios: true
Expand Down

0 comments on commit 48899bc

Please sign in to comment.