Skip to content

Commit

Permalink
Update betterSqlite3Adapter.test.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
David ALLIX authored Nov 26, 2024
1 parent bd7a306 commit 4ecd395
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions tests/adapters/betterSqlite3Adapter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ describe('BetterSqlite3Adapter', () => {

it('should handle parameters correctly', () => {
adapter.queryAll(`
INSERT INTO users (name, email) VALUES ('Bob', '[email protected]')
`)()
INSERT INTO users (name, email) VALUES (:name, :email)
`)({ name: 'Bob', email: '[email protected]' })

const users = adapter.queryAll<{ id: number; name: string; email: string }>(
'SELECT * FROM users WHERE name = :name'
Expand Down Expand Up @@ -137,8 +137,8 @@ describe('BetterSqlite3Adapter', () => {
assert.throws(
() =>
adapter.queryAll(`
INSERT INTO users (name, email) VALUES ('Charlie', '[email protected]')
`)(),
INSERT INTO users (name, email) VALUES (:name, :email)
`)({ name: 'Charlie', email: '[email protected]' }),
{
code: SchemQlAdapterErrorCode.UniqueConstraint,
message: 'UNIQUE constraint failed: users.email',
Expand All @@ -160,8 +160,8 @@ describe('BetterSqlite3Adapter', () => {
assert.throws(
() =>
adapter.queryAll(`
INSERT INTO posts (title, user_id) VALUES ('Post 1', 999)
`)(),
INSERT INTO posts (title, user_id) VALUES (:title, :user_id)
`)({ title: 'Post 1', user_id: 999 }),
{
code: SchemQlAdapterErrorCode.ForeignkeyConstraint,
message: 'FOREIGN KEY constraint failed',
Expand All @@ -173,8 +173,8 @@ describe('BetterSqlite3Adapter', () => {
assert.throws(
() =>
adapter.queryAll(`
INSERT INTO users (name) VALUES ('Charlie')
`)(),
INSERT INTO users (name) VALUES (:name)
`)({ name: 'Charlie' }),
{
code: SchemQlAdapterErrorCode.NotnullConstraint,
message: 'NOT NULL constraint failed: users.email',
Expand All @@ -195,8 +195,8 @@ describe('BetterSqlite3Adapter', () => {
assert.throws(
() =>
adapter.queryAll(`
INSERT INTO products (name, price) VALUES ('Product 1', -1)
`)(),
INSERT INTO products (name, price) VALUES (:name, :price)
`)({ name: 'Product 1', price: -1 }),
{
code: SchemQlAdapterErrorCode.CheckConstraint,
message: 'CHECK constraint failed: price > 0',
Expand All @@ -208,8 +208,8 @@ describe('BetterSqlite3Adapter', () => {
assert.throws(
() =>
adapter.queryAll(`
INSERT INTO users (id, name, email) VALUES (1, 'Charlie', '[email protected]')
`)(),
INSERT INTO users (id, name, email) VALUES (:id, :name, :email)
`)({ id: 1, name: 'Charlie', email: '[email protected]' }),
{
code: SchemQlAdapterErrorCode.PrimarykeyConstraint,
message: 'UNIQUE constraint failed: users.id',
Expand Down

0 comments on commit 4ecd395

Please sign in to comment.