Skip to content

Commit

Permalink
Update build output test to use .compareTo()/.isSameMomentAs() as ope…
Browse files Browse the repository at this point in the history
…rators don't exist on DateTime (#1769)

Closes: #1745
  • Loading branch information
mkustermann authored Nov 29, 2024
1 parent 9c33168 commit 058675e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
10 changes: 6 additions & 4 deletions pkgs/native_assets_cli/test/build_output_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@ void main() {
linkInPackage: 'package:linker2');

final config = BuildOutput(builder.json);
expect(config.timestamp, greaterThanOrEqualTo(before));
expect(config.timestamp, lessThanOrEqualTo(after));
expect(config.timestamp,
lessThanOrEqualTo(config.timestamp.roundDownToSeconds()));
expect(config.timestamp.compareTo(before), greaterThanOrEqualTo(0));
expect(config.timestamp.compareTo(after), lessThanOrEqualTo(0));
expect(
config.timestamp
.isAtSameMomentAs(config.timestamp.roundDownToSeconds()),
true);

// The JSON format of the build output.
<String, Object?>{
Expand Down
10 changes: 6 additions & 4 deletions pkgs/native_assets_cli/test/link_output_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ void main() {
builder.addEncodedAssets(assets.skip(1).take(2).toList());

final config = BuildOutput(builder.json);
expect(config.timestamp, greaterThanOrEqualTo(before));
expect(config.timestamp, lessThanOrEqualTo(after));
expect(config.timestamp,
lessThanOrEqualTo(config.timestamp.roundDownToSeconds()));
expect(config.timestamp.compareTo(before), greaterThanOrEqualTo(0));
expect(config.timestamp.compareTo(after), lessThanOrEqualTo(0));
expect(
config.timestamp
.isAtSameMomentAs(config.timestamp.roundDownToSeconds()),
true);

// The JSON format of the link output.
<String, Object?>{
Expand Down

0 comments on commit 058675e

Please sign in to comment.