From 57d9ca740faf43200da0f5db8258a169f1191eb1 Mon Sep 17 00:00:00 2001 From: Harminder Virk Date: Thu, 11 Jan 2024 07:46:50 +0530 Subject: [PATCH] refactor: fix mess created by the merge --- test/database/query_builder.spec.ts | 43 +++-------------------------- test/orm/model_has_many.spec.ts | 2 +- 2 files changed, 5 insertions(+), 40 deletions(-) diff --git a/test/database/query_builder.spec.ts b/test/database/query_builder.spec.ts index dce8f3bd..c0352c37 100644 --- a/test/database/query_builder.spec.ts +++ b/test/database/query_builder.spec.ts @@ -451,41 +451,6 @@ test.group('Query Builder | where', (group) => { await connection.disconnect() }) - test('add where clause with a null comparison', async ({ assert }) => { - const connection = new Connection('primary', getConfig(), app.logger) - connection.connect() - - let db = getQueryBuilder(getQueryClient(connection, app)) - const { sql, bindings } = db.from('users').where('username', null).toSQL() - - const { sql: knexSql, bindings: knexBindings } = connection - .client!.from('users') - .where('username', null) - .toSQL() - - assert.equal(sql, knexSql) - assert.deepEqual(bindings, knexBindings) - - /** - * Using keys resolver - */ - db = getQueryBuilder(getQueryClient(connection, app)) - db.keysResolver = (key) => `my_${key}` - const { sql: resolverSql, bindings: resolverBindings } = db - .from('users') - .where('username', null) - .toSQL() - - const { sql: knexResolverSql, bindings: knexResolverBindings } = connection - .client!.from('users') - .where('my_username', null) - .toSQL() - - assert.equal(resolverSql, knexResolverSql) - assert.deepEqual(resolverBindings, knexResolverBindings) - await connection.disconnect() - }) - test('wrap where clause to its own group', async ({ assert }) => { const connection = new Connection('primary', getConfig(), logger) connection.connect() @@ -7020,7 +6985,7 @@ test.group('Query Builder | havingNull', (group) => { const { sql: knexSql, bindings: knexBindings } = (connection.client as any) .from('users') ['havingNull']('deleted_at') - ['orHavingNull']('updated_at') + .orHavingNull('updated_at') .toSQL() assert.equal(sql, knexSql) @@ -7038,7 +7003,7 @@ test.group('Query Builder | havingNull', (group) => { const { sql: knexResolverSql, bindings: knexResolverBindings } = (connection.client as any) .from('users') ['havingNull']('my_deleted_at') - ['orHavingNull']('my_updated_at') + .orHavingNull('my_updated_at') .toSQL() assert.equal(resolverSql, knexResolverSql) @@ -7110,7 +7075,7 @@ test.group('Query Builder | havingNotNull', (group) => { .from('users') .from('users') ['havingNotNull']('deleted_at') - ['orHavingNotNull']('updated_at') + .orHavingNotNull('updated_at') .toSQL() assert.equal(sql, knexSql) @@ -7128,7 +7093,7 @@ test.group('Query Builder | havingNotNull', (group) => { const { sql: knexResolverSql, bindings: knexResolverBindings } = (connection.client as any) .from('users') ['havingNotNull']('my_deleted_at') - ['orHavingNotNull']('my_updated_at') + .orHavingNotNull('my_updated_at') .toSQL() assert.equal(resolverSql, knexResolverSql) diff --git a/test/orm/model_has_many.spec.ts b/test/orm/model_has_many.spec.ts index 1b8562ee..39eb8606 100644 --- a/test/orm/model_has_many.spec.ts +++ b/test/orm/model_has_many.spec.ts @@ -3787,7 +3787,7 @@ if (process.env.DB !== 'mysql_legacy') { User.boot() const users = await User.query().preload('posts', (query) => { - query.groupLimit(2).groupOrderBy('created_at', 'asc') + query.groupLimit(2).groupOrderBy('created_at', 'desc') }) assert.lengthOf(users, 2)