Skip to content

Commit

Permalink
fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
codekeyz committed Jun 16, 2024
1 parent b68b3b3 commit a75a247
Showing 1 changed file with 8 additions and 18 deletions.
26 changes: 8 additions & 18 deletions _tests_/test/integration/e2e_basic.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ void runBasicE2ETest(String connectionName) {
expect(driver.isOpen, isTrue);
});

test('should have no tables',
() async => expect(await driver.hasTable('users'), isFalse));
test('should have no tables', () async => expect(await driver.hasTable('users'), isFalse));

test('should execute migration', () async {
await runMigrator(connectionName, 'migrate');
Expand Down Expand Up @@ -49,8 +48,7 @@ void runBasicE2ETest(String connectionName) {
});

group('Aggregate Functions', () {
final query = UserQuery.driver(driver)
.where((user) => user.$isLike('home_address', '%%, Ghana'));
final query = UserQuery.driver(driver).where((user) => user.$isLike('home_address', '%%, Ghana'));
List<User> usersInGhana = [];

setUpAll(() async {
Expand Down Expand Up @@ -84,8 +82,7 @@ void runBasicE2ETest(String connectionName) {

test('concat', () async {
Matcher matcher(String separator) {
if ([DatabaseDriverType.sqlite, DatabaseDriverType.pgsql]
.contains(driver.type)) {
if ([DatabaseDriverType.sqlite, DatabaseDriverType.pgsql].contains(driver.type)) {
return equals(usersInGhana.map((e) => e.age).join(separator));
}

Expand Down Expand Up @@ -130,13 +127,11 @@ void runBasicE2ETest(String connectionName) {
final updatedResult = await age50Users.findMany();
expect(updatedResult.length, 4);
expect(updatedResult.every((e) => e.age == 50), isTrue);
expect(
updatedResult.every((e) => e.homeAddress == 'Keta, Ghana'), isTrue);
expect(updatedResult.every((e) => e.homeAddress == 'Keta, Ghana'), isTrue);
});

test('should fetch only users in Ghana', () async {
final userQuery = UserQuery.driver(driver)
.where((user) => user.$isLike('home_address', '%, Ghana'));
final userQuery = UserQuery.driver(driver).where((user) => user.$isLike('home_address', '%, Ghana'));

final usersInGhana = await userQuery.findMany();
expect(usersInGhana.length, 10);
Expand Down Expand Up @@ -169,13 +164,9 @@ void runBasicE2ETest(String connectionName) {
});

test('should get all users where age is 30 or 52', () async {
final users = await UserQuery.driver(driver)
.where((user) => or([user.age(30), user.age(52)]))
.findMany();
final users = await UserQuery.driver(driver).where((user) => or([user.age(30), user.age(52)])).findMany();

final users2 = await UserQuery.driver(driver)
.where((user) => user.age(30) | user.age(52))
.findMany();
final users2 = await UserQuery.driver(driver).where((user) => user.age(30) | user.age(52)).findMany();

expect(users.every((e) => [30, 52].contains(e.age)), isTrue);
expect(users2.every((e) => [30, 52].contains(e.age)), isTrue);
Expand All @@ -194,8 +185,7 @@ void runBasicE2ETest(String connectionName) {
});

test('should delete many users', () async {
final query = UserQuery.driver(driver)
.where((user) => user.$isLike('home_address', '%, Nigeria'));
final query = UserQuery.driver(driver).where((user) => user.$isLike('home_address', '%, Nigeria'));
expect(await query.findMany(), isNotEmpty);

await query.delete();
Expand Down

0 comments on commit a75a247

Please sign in to comment.