Skip to content

Commit

Permalink
Add test for makePositionalParam
Browse files Browse the repository at this point in the history
  • Loading branch information
msfstef committed Jun 26, 2024
1 parent 9030db4 commit ad2e578
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions clients/typescript/test/migrators/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,26 @@ export const builderTests = (test: TestFn<ContextType>) => {
])
})

test('makePositionalParam generates correct parameter strings', (t) => {
const { builder } = t.context
const numParams = 4
let expectedParams: string[]
switch (builder.dialect) {
case 'SQLite':
expectedParams = ['?', '?', '?', '?']
break
case 'Postgres':
expectedParams = ['$1', '$2', '$3', '$4']
break
}
t.deepEqual(
Array.from({ length: numParams }, (_, idx) =>
builder.makePositionalParam(idx + 1)
),
expectedParams
)
})

test('prepareInsertBatchedStatements correctly splits up data in batches', (t) => {
const { builder } = t.context
const data = [
Expand Down

0 comments on commit ad2e578

Please sign in to comment.