Update test case

This commit is contained in:
thomashii@dukefirehawk.com 2021-05-05 23:05:13 +08:00
parent 6e8f6aea9e
commit 0addba99d3
3 changed files with 15 additions and 12 deletions

View file

@ -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 (35/54 tests passed)
* Migrated angel_orm_postgres to 3.0.0 (44/54 tests passed)
* Update orm-sdk-2.12.x boilerplate (in progress) <= Milestone 2

View file

@ -58,15 +58,18 @@ belongsToTests(FutureOr<QueryExecutor> Function() createExecutor,
query.where!.id.equals(int.parse(deathlyHallows!.id!));
print(query.compile(Set()));
var book = await (query.getOne(executor) as FutureOr<Book>);
print(book.toJson());
expect(book.id, deathlyHallows!.id);
expect(book.name, deathlyHallows!.name);
var bookOpt = await query.getOne(executor);
expect(bookOpt.isPresent, true);
bookOpt.ifPresent((book) {
print(book.toJson());
expect(book.id, deathlyHallows!.id);
expect(book.name, deathlyHallows!.name);
var author = book.author!;
print(AuthorSerializer.toMap(author));
expect(author.id, jkRowling!.id);
expect(author.name, jkRowling!.name);
var author = book.author!;
print(AuthorSerializer.toMap(author));
expect(author.id, jkRowling!.id);
expect(author.name, jkRowling!.name);
});
});
test('where clause', () async {

View file

@ -111,9 +111,9 @@ edgeCaseTests(FutureOr<QueryExecutor> Function() createExecutor,
await pivotQuery.insert(executor);
fooQuery = FooQuery()..where!.bar.equals('baz');
var fooObj = await fooQuery.getOne(executor);
expect(fooObj.isPresent, true);
fooObj.ifPresent((foo) {
var fooOpt = await fooQuery.getOne(executor);
expect(fooOpt.isPresent, true);
fooOpt.ifPresent((foo) {
print(foo.toJson());
print(weirdJoin!.toJson());
expect(foo.weirdJoins![0].id, weirdJoin!.id);