Skip to content

Commit

Permalink
Add test for mutiple connections
Browse files Browse the repository at this point in the history
  • Loading branch information
ospfranco committed Dec 14, 2024
1 parent 50b96a0 commit 33438ff
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions example/src/tests/queries.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,30 @@ export function queriesTests() {
// });
// }

it('Can create multiple connections to same db', async () => {
const db2 = open({
name: 'queries.sqlite',
encryptionKey: 'test',
});

const db3 = open({
name: 'queries.sqlite',
encryptionKey: 'test',
});

let promises = [
db.execute('SELECT 1'),
db2.execute('SELECT 1'),
db3.execute('SELECT 1'),
];

let res = await Promise.all(promises);
res.forEach(r => {
expect(r.rowsAffected).to.equal(0);
expect(r.rows[0]!['1']).to.equal(1);
});
});

it('Trying to pass object as param should throw', async () => {
try {
// @ts-ignore
Expand Down

0 comments on commit 33438ff

Please sign in to comment.