Skip to content

Commit

Permalink
Merge pull request #59 from exaby73/chore/test-action
Browse files Browse the repository at this point in the history
Add melos script for tests
  • Loading branch information
exaby73 authored Feb 18, 2024
2 parents 3e84cfc + 05e77bb commit e45606e
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 6 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Unit Tests

on:
pull_request:
push:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: dart-lang/setup-dart@v1
- run: dart pub global activate melos
- run: melos bootstrap
- run: melos test
9 changes: 9 additions & 0 deletions melos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,12 @@ packages:
scripts:
analyze:
run: dart analyze

format:
run: dart format --set-exit-if-changed .

test:
exec: dart test
packageFilters:
scope:
- luthor
2 changes: 1 addition & 1 deletion packages/luthor_annotation/lib/src/validators/max.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ class HasMax {
final int max;

const HasMax(this.max, {this.message});
}
}
2 changes: 1 addition & 1 deletion packages/luthor_annotation/lib/src/validators/min.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ class HasMin {
final int min;

const HasMin(this.min, {this.message});
}
}
2 changes: 1 addition & 1 deletion packages/luthor_annotation/lib/src/validators/uri.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ class IsUri {
const IsUri({this.allowedSchemes, this.message});
}

const isUri = IsUri();
const isUri = IsUri();
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class LuthorGenerator extends GeneratorForAnnotation<Luthor> {
element: element,
);
}

if (element.constructors.isEmpty) {
throw InvalidGenerationSourceError(
'Luthor can only be applied to classes with at least one constructor.',
Expand All @@ -36,7 +36,7 @@ class LuthorGenerator extends GeneratorForAnnotation<Luthor> {
element: element,
);
}

final validateMethod = element.getMethod('validate');
final isInvalidMethod = validateMethod == null ||
!validateMethod.isStatic ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ void _checkAndWriteDateTimeValidation(
ParameterElement param,
) {
final dateTimeAnnotation = getAnnotation(isDateTimeChecker, param);
if (dateTimeAnnotation != null || param.type.getDisplayString(withNullability: false) == 'DateTime') {
if (dateTimeAnnotation != null ||
param.type.getDisplayString(withNullability: false) == 'DateTime') {
buffer.write('.dateTime(');
final message = dateTimeAnnotation?.getField('message')?.toStringValue();
if (message != null) buffer.write("message: '$message'");
Expand Down

0 comments on commit e45606e

Please sign in to comment.