Skip to content

Commit

Permalink
ci: updated dart-coverage-assistant
Browse files Browse the repository at this point in the history
  • Loading branch information
timcreatedit committed Apr 15, 2024
1 parent 7803a50 commit 4b2cd03
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 3 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,8 @@ jobs:

- name: 📊 Generate Coverage
id: coverage-report
uses: whynotmake-it/dart-coverage-assistant@825dd99025d7e29a5b2b65eadea79c38e47ebfa2
uses: whynotmake-it/dart-coverage-assistant@v1
with:
enforce_threshold: 'single'
enforce_forbidden_decrease: 'none'
lower_threshold: 50
upper_threshold: 90
generate_badges: pr
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,72 @@ void main() {
});
});

group('with mixed (#38)', () {
// ignore: unused_local_variable
late Iterable<File> files;
setUp(() async {
files = await sut.generate(
projectName: "figmage_example",
dir: testDirectory,
description: "A test",
generateNumbers: false,
generateSpacers: false,
generatePaddings: false,
generateRadii: false,
generateStrings: false,
generateBools: false,
);
});

test('generates only the files that are not disabled', () async {
verify(
() => generatorTarget.createFile(
any(that: contains("lib/src/colors.dart")),
any(that: isEmpty),
),
).called(1);
verify(
() => generatorTarget.createFile(
any(that: contains("lib/src/typography.dart")),
any(that: isEmpty),
),
).called(1);
verifyNever(
() => generatorTarget.createFile(
any(that: contains("lib/src/numbers.dart")),
any(),
),
);
verifyNever(
() => generatorTarget.createFile(
any(that: contains("lib/src/bools.dart")),
any(),
),
);
verifyNever(
() => generatorTarget.createFile(
any(that: contains("lib/src/numbers.dart")),
any(),
),
);
});

test('only the generated files are in export', () {
final content = verify(
() => generatorTarget.createFile(
any(that: contains("figmage_example.dart")),
captureAny(),
),
).captured.first as List<int>;
final decoded = utf8.decode(content);

expect(
decoded,
equals(_expectedMixedLibraryFile),
);
});
});

test('throws if package URI could not be resolved', () async {
sut = FigmagePackageGenerator(
generatorTargetFactory: (_) => _MockGeneratorTarget(),
Expand Down Expand Up @@ -302,4 +368,18 @@ library figmage_example;
''';

const _expectedMixedLibraryFile = '''
/// A test
library figmage_example;
export 'src/colors.dart';
export 'src/typography.dart';
''';

0 comments on commit 4b2cd03

Please sign in to comment.