From 922eaa102b2a8bd48deadaa342352511a49d822f Mon Sep 17 00:00:00 2001 From: "thomashii@dukefirehawk.com" Date: Tue, 4 May 2021 22:14:27 +0800 Subject: [PATCH] Fixed test cases --- CHANGELOG.md | 2 +- .../orm/angel_orm_test/lib/src/belongs_to_test.dart | 12 +++++++----- .../orm/angel_orm_test/lib/src/standalone_test.dart | 7 ++----- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dcf38b1f..d01147dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,7 +37,7 @@ * Migrated angel_orm_generator to 4.0.0 (0/0 tests passed) * Migrated angel_migration_runner to 3.0.0 (0/0 tests passed) * Migrated angel_orm_test to 3.0.0 (0/0 tests passed) -* Migrated angel_orm_postgres to 3.0.0 (21/54 tests passed) +* Migrated angel_orm_postgres to 3.0.0 (25/54 tests passed) * Update orm-sdk-2.12.x boilerplate (in progress) <= Milestone 2 diff --git a/packages/orm/angel_orm_test/lib/src/belongs_to_test.dart b/packages/orm/angel_orm_test/lib/src/belongs_to_test.dart index 7093f21d..00e19ba4 100644 --- a/packages/orm/angel_orm_test/lib/src/belongs_to_test.dart +++ b/packages/orm/angel_orm_test/lib/src/belongs_to_test.dart @@ -144,11 +144,13 @@ belongsToTests(FutureOr Function() createExecutor, var query = BookQuery() ..where!.id.equals(int.parse(cloned.id!)) ..values.copyFrom(cloned); - var book = await (query.updateOne(executor) as FutureOr); - print(book.toJson()); - expect(book.name, cloned.name); - expect(book.author, isNotNull); - expect(book.author!.name, jkRowling!.name); + var bookOpt = await (query.updateOne(executor)); + bookOpt.ifPresent((book) { + print(book.toJson()); + expect(book.name, cloned.name); + expect(book.author, isNotNull); + expect(book.author!.name, jkRowling!.name); + }); }); group('joined subquery', () { diff --git a/packages/orm/angel_orm_test/lib/src/standalone_test.dart b/packages/orm/angel_orm_test/lib/src/standalone_test.dart index f2d20bbd..79d83db9 100644 --- a/packages/orm/angel_orm_test/lib/src/standalone_test.dart +++ b/packages/orm/angel_orm_test/lib/src/standalone_test.dart @@ -195,17 +195,14 @@ standaloneTests(FutureOr Function() createExecutor, recalledAt: recalledAt); var query = CarQuery()..values.copyFrom(beetle); var carOpt = await (query.insert(executor)); - if (carOpt.isPresent) { - var car = carOpt.value; + carOpt.ifPresent((car) { print(car.toJson()); expect(car.make, beetle.make); expect(car.description, beetle.description); expect(car.familyFriendly, beetle.familyFriendly); expect(dateYmdHms.format(car.recalledAt!), dateYmdHms.format(beetle.recalledAt!)); - } else { - print("Car is null"); - } + }); }); }); }