Skip to content

Commit

Permalink
Add Tests: Limit 0
Browse files Browse the repository at this point in the history
  • Loading branch information
sillvva committed Jul 19, 2024
1 parent 240dd1c commit 261728b
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
12 changes: 12 additions & 0 deletions integration-tests/tests/mysql/mysql-common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3486,4 +3486,16 @@ export function tests(driver?: string) {
await db.execute(sql`drop view ${newYorkers1}`);
});
});

test('limit 0', async (ctx) => {
const { db } = ctx.mysql;

await db.insert(usersTable).values({ name: 'John' });
const users = await db
.select()
.from(usersTable)
.limit(0);

expect(users).toEqual([]);
});
}
12 changes: 12 additions & 0 deletions integration-tests/tests/pg/pg-common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4428,5 +4428,17 @@ export function tests() {

await db.execute(sql`drop materialized view ${newYorkers1}`);
});

test('limit 0', async (ctx) => {
const { db } = ctx.pg;

await db.insert(usersTable).values({ name: 'John' });
const users = await db
.select()
.from(usersTable)
.limit(0);

expect(users).toEqual([]);
});
});
}
12 changes: 12 additions & 0 deletions integration-tests/tests/sqlite/sqlite-common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2681,4 +2681,16 @@ export function tests() {
expect(columnField?.isUnique).toBeTruthy();
expect(columnField?.uniqueName).toBe(uniqueKeyName(cities1Table, [columnField!.name]));
});

test('limit 0', async (ctx) => {
const { db } = ctx.sqlite;

await db.insert(usersTable).values({ name: 'John' });
const users = await db
.select()
.from(usersTable)
.limit(0);

expect(users).toEqual([]);
});
}

0 comments on commit 261728b

Please sign in to comment.