Skip to content

Commit

Permalink
all kysely tests passing
Browse files Browse the repository at this point in the history
  • Loading branch information
marshallswain committed Apr 4, 2024
1 parent 1654d10 commit 3117da5
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 60 deletions.
3 changes: 2 additions & 1 deletion packages/kysely/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ export class KyselyAdapter<
createQuery(options: KyselyOptions<Tables>, 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
Expand Down
118 changes: 59 additions & 59 deletions packages/kysely/test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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()
})
Expand Down

0 comments on commit 3117da5

Please sign in to comment.