Skip to content

Commit

Permalink
coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanoltman committed Jan 2, 2025
1 parent 8013c4a commit b43545c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ class TrackedLockFilesValidator extends Validator {
String get description => 'Lock files are tracked in source control';

@override
bool canRunInCurrentContext() {
return shorebirdEnv.hasPubspecYaml;
}
bool canRunInCurrentContext() => shorebirdEnv.hasPubspecYaml;

@override
Future<List<ValidationIssue>> validate() async {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,37 @@ void main() {
shorebirdEnv = MockShorebirdEnv();
projectRoot = Directory.systemTemp.createTempSync();

validator = TrackedLockFilesValidator();

when(() => shorebirdEnv.getFlutterProjectRoot()).thenReturn(projectRoot);

validator = TrackedLockFilesValidator();
});

test('has a non-empty description', () {
expect(validator.description, isNotEmpty);
});

group('canRunInCurrentContext', () {
group('when a pubspec.yaml file exists', () {
setUp(() {
when(() => shorebirdEnv.hasPubspecYaml).thenReturn(true);
});

test('returns true', () {
expect(runWithOverrides(validator.canRunInCurrentContext), isTrue);
});
});

group('when a pubspec.yaml file does not exist', () {
setUp(() {
when(() => shorebirdEnv.hasPubspecYaml).thenReturn(false);
});

test('returns false', () {
expect(runWithOverrides(validator.canRunInCurrentContext), isFalse);
});
});
});

group('validate', () {
group('when no project root is found', () {
setUp(() {
Expand Down

0 comments on commit b43545c

Please sign in to comment.