-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
303 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ environment: | |
sdk: ^3.4.0 | ||
|
||
dependencies: | ||
equatable: ^2.0.5 | ||
mason: ^0.1.0-dev.52 | ||
|
||
dev_dependencies: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
very_good_core/hooks/test/src/models/android_application_id_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import 'package:test/test.dart'; | ||
import 'package:very_good_core_hooks/very_good_core_hooks.dart'; | ||
|
||
void main() { | ||
group('$AndroidApplicationId', () { | ||
group('fallback', () { | ||
test( | ||
'concatenates organization name with project name in snake case', | ||
() { | ||
const organizationName = 'com.example.hello-world'; | ||
const projectName = 'my app'; | ||
final androidApplicationId = AndroidApplicationId.fallback( | ||
organizationName: organizationName, | ||
projectName: projectName, | ||
); | ||
expect(androidApplicationId.value, 'com.example.hello_world.my_app'); | ||
}, | ||
); | ||
|
||
test( | ||
'ignores empty segments', | ||
() { | ||
const organizationName = 'com..example..hello-world'; | ||
const projectName = 'my app'; | ||
final androidApplicationId = AndroidApplicationId.fallback( | ||
organizationName: organizationName, | ||
projectName: projectName, | ||
); | ||
expect(androidApplicationId.value, 'com.example.hello_world.my_app'); | ||
}, | ||
); | ||
}); | ||
|
||
group('isValid', () { | ||
group('returns true', () { | ||
test('when Android ID is valid', () { | ||
final androidApplicationId = AndroidApplicationId('com.example.app'); | ||
expect(androidApplicationId.isValid, isTrue); | ||
}); | ||
}); | ||
|
||
group('returns false', () { | ||
test('when Android ID has less than two segments', () { | ||
final androidApplicationId = AndroidApplicationId('com'); | ||
expect(androidApplicationId.isValid, isFalse); | ||
}); | ||
|
||
test('when Android ID has a segment that starts with a non-letter', () { | ||
final androidApplicationId = AndroidApplicationId('1com.example.app'); | ||
expect(androidApplicationId.isValid, isFalse); | ||
}); | ||
|
||
test('when Android ID has a segment with a special character', () { | ||
final androidApplicationId = AndroidApplicationId('com.example.app!'); | ||
expect(androidApplicationId.isValid, isFalse); | ||
}); | ||
}); | ||
}); | ||
}); | ||
} |
Oops, something went wrong.