Updated test cases

This commit is contained in:
thomashii@dukefirehawk.com 2021-05-05 09:22:16 +08:00
parent bd6fe44cc0
commit 975c42000d
4 changed files with 14 additions and 11 deletions

View file

@ -105,7 +105,7 @@ class LegQuery extends Query<Leg, LegQueryWhere> {
name: (row[3] as String?)); name: (row[3] as String?));
if (row.length > 4) { if (row.length > 4) {
model = model.copyWith( model = model.copyWith(
foot: FootQuery.parseRow(row.skip(4).take(5).toList()).value); foot: FootQuery.parseRow(row.skip(4).take(5).toList()).firstOrNull);
} }
return Optional.ofNullable(model); return Optional.ofNullable(model);
} }

View file

@ -104,8 +104,9 @@ class TreeQuery extends Query<Tree, TreeQueryWhere> {
updatedAt: (row[2] as DateTime?), updatedAt: (row[2] as DateTime?),
rings: (row[3] as int?)); rings: (row[3] as int?));
if (row.length > 4) { if (row.length > 4) {
model = model.copyWith( model = model.copyWith(fruits: [
fruits: [FruitQuery.parseRow(row.skip(4).take(5).toList()).value]); FruitQuery.parseRow(row.skip(4).take(5).toList()).firstOrNull
]);
} }
return Optional.ofNullable(model); return Optional.ofNullable(model);
} }

View file

@ -261,20 +261,21 @@ class WeirdJoinQuery extends Query<WeirdJoin, WeirdJoinQueryWhere> {
var model = WeirdJoin(id: (row[0] as int?)); var model = WeirdJoin(id: (row[0] as int?));
if (row.length > 2) { if (row.length > 2) {
model = model.copyWith( model = model.copyWith(
unorthodox: unorthodox: UnorthodoxQuery.parseRow(row.skip(2).take(1).toList())
UnorthodoxQuery.parseRow(row.skip(2).take(1).toList()).value); .firstOrNull);
} }
if (row.length > 3) { if (row.length > 3) {
model = model.copyWith( model = model.copyWith(
song: SongQuery.parseRow(row.skip(3).take(5).toList()).value); song: SongQuery.parseRow(row.skip(3).take(5).toList()).firstOrNull);
} }
if (row.length > 8) { if (row.length > 8) {
model = model.copyWith( model = model.copyWith(numbas: [
numbas: [NumbaQuery.parseRow(row.skip(8).take(2).toList()).value]); NumbaQuery.parseRow(row.skip(8).take(2).toList()).firstOrNull
]);
} }
if (row.length > 10) { if (row.length > 10) {
model = model.copyWith( model = model.copyWith(
foos: [FooQuery.parseRow(row.skip(10).take(1).toList()).value]); foos: [FooQuery.parseRow(row.skip(10).take(1).toList()).firstOrNull]);
} }
return Optional.ofNullable(model); return Optional.ofNullable(model);
} }

View file

@ -123,8 +123,9 @@ class UserQuery extends Query<User, UserQueryWhere> {
password: (row[4] as String?), password: (row[4] as String?),
email: (row[5] as String?)); email: (row[5] as String?));
if (row.length > 6) { if (row.length > 6) {
model = model.copyWith( model = model.copyWith(roles: [
roles: [RoleQuery.parseRow(row.skip(6).take(4).toList()).value]); RoleQuery.parseRow(row.skip(6).take(4).toList()).firstOrNull
]);
} }
return Optional.ofNullable(model); return Optional.ofNullable(model);
} }