From eb14840981e670ee33b6a33cb0ad442573ae3c6c Mon Sep 17 00:00:00 2001 From: Martin Kustermann Date: Fri, 29 Nov 2024 12:07:58 +0100 Subject: [PATCH] Update build output test to use .compareTo()/.isSameMomentAs() as operators don't exist on DateTime --- pkgs/native_assets_cli/test/build_output_test.dart | 10 ++++++---- pkgs/native_assets_cli/test/link_output_test.dart | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/pkgs/native_assets_cli/test/build_output_test.dart b/pkgs/native_assets_cli/test/build_output_test.dart index 7eb7b30da..d58f1c920 100644 --- a/pkgs/native_assets_cli/test/build_output_test.dart +++ b/pkgs/native_assets_cli/test/build_output_test.dart @@ -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. { diff --git a/pkgs/native_assets_cli/test/link_output_test.dart b/pkgs/native_assets_cli/test/link_output_test.dart index a79d81a18..adb5e80a3 100644 --- a/pkgs/native_assets_cli/test/link_output_test.dart +++ b/pkgs/native_assets_cli/test/link_output_test.dart @@ -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. {