From 3117da5f645e90c1abbcfc1b0bb3acb05f4e8345 Mon Sep 17 00:00:00 2001 From: Marshall Thompson Date: Thu, 4 Apr 2024 12:51:23 -0600 Subject: [PATCH] all kysely tests passing --- packages/kysely/src/index.ts | 3 +- packages/kysely/test/index.test.ts | 118 ++++++++++++++--------------- 2 files changed, 61 insertions(+), 60 deletions(-) diff --git a/packages/kysely/src/index.ts b/packages/kysely/src/index.ts index 6b516ad..1ea8e78 100644 --- a/packages/kysely/src/index.ts +++ b/packages/kysely/src/index.ts @@ -114,7 +114,8 @@ export class KyselyAdapter< createQuery(options: KyselyOptions, filters: any, query: any) { const q = this.startSelectQuery(options, filters) const qWhere = this.applyWhere(q, query) - const qLimit = filters.$limit ? qWhere.limit(filters.$limit) : qWhere + // if limit isn't provided but skip is, set limit to 10. Really, people should be specific in their query limit + const qLimit = filters.$limit ? qWhere.limit(filters.$limit) : filters.$skip ? qWhere.limit(10) : qWhere const qSkip = filters.$skip ? qLimit.offset(filters.$skip) : qLimit const qSorted = this.applySort(qSkip as any, filters) return qSorted diff --git a/packages/kysely/test/index.test.ts b/packages/kysely/test/index.test.ts index 849f4ed..6ed6355 100644 --- a/packages/kysely/test/index.test.ts +++ b/packages/kysely/test/index.test.ts @@ -10,64 +10,64 @@ const dialect = new SqliteDialect({ }) const testSuite = adapterTests([ - // '.id', - // '.options', - // '.get', - // '.get + $select', - // '.get + id + query', - // '.get + NotFound', - // '.get + id + query id', - // '.find', - // '.find + paginate + query', - // '.find + $and', - // '.find + $and + $or', - // '.remove', - // '.remove + $select', - // '.remove + id + query', - // '.remove + multi', - // '.remove + multi no pagination', - // '.remove + id + query id', - // '.update', - // '.update + $select', - // '.update + id + query', - // '.update + NotFound', - // '.update + id + query id', - '.update + query + NotFound' - // '.patch', - // '.patch + $select', - // '.patch + id + query', - // '.patch multiple', - // '.patch multiple no pagination', - // '.patch multi query same', - // '.patch multi query changed', - // '.patch + query + NotFound', - // '.patch + NotFound', - // '.patch + id + query id', - // '.create', - // '.create ignores query', - // '.create + $select', - // '.create multi', - // '.find + equal', - // '.find + equal multiple', - // '.find + $sort', - // '.find + $limit', - // '.find + $limit 0', - // '.find + $skip', - // '.find + $select', - // '.find + $or', - // '.find + $in', - // '.find + $nin', - // '.find + $lt', - // '.find + $lte', - // '.find + $gt', - // '.find + $gte', - // '.find + $ne', - // '.find + $gt + $lt + $sort', - // '.find + $or nested + $sort', - // '.find + paginate', - // '.find + paginate + $limit + $skip', - // '.find + paginate + $limit 0', - // '.find + paginate + params' + '.id', + '.options', + '.get', + '.get + $select', + '.get + id + query', + '.get + NotFound', + '.get + id + query id', + '.find', + '.find + paginate + query', + '.find + $and', + '.find + $and + $or', + '.remove', + '.remove + $select', + '.remove + id + query', + '.remove + multi', + '.remove + multi no pagination', + '.remove + id + query id', + '.update', + '.update + $select', + '.update + id + query', + '.update + NotFound', + '.update + id + query id', + '.update + query + NotFound', + '.patch', + '.patch + $select', + '.patch + id + query', + '.patch multiple', + '.patch multiple no pagination', + '.patch multi query same', + '.patch multi query changed', + '.patch + query + NotFound', + '.patch + NotFound', + '.patch + id + query id', + '.create', + '.create ignores query', + '.create + $select', + '.create multi', + '.find + equal', + '.find + equal multiple', + '.find + $sort', + '.find + $limit', + '.find + $limit 0', + '.find + $skip', + '.find + $select', + '.find + $or', + '.find + $in', + '.find + $nin', + '.find + $lt', + '.find + $lte', + '.find + $gt', + '.find + $gte', + '.find + $ne', + '.find + $gt + $lt + $sort', + '.find + $or nested + $sort', + '.find + paginate', + '.find + paginate + $limit + $skip', + '.find + paginate + $limit 0', + '.find + paginate + params' ]) interface Tables { @@ -89,7 +89,7 @@ describe('Wings kysely Adapter', () => { .createTable('people') .addColumn('id', 'integer', (col) => col.primaryKey()) .addColumn('name', 'varchar', (col) => col.notNull()) - .addColumn('age', 'integer', (col) => col.notNull()) + .addColumn('age', 'integer') .addColumn('created', 'boolean') .execute() })