Skip to content

Commit

Permalink
Increase test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
MelleB committed Aug 17, 2024
1 parent e17b57f commit 107ffcb
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ describe('explicit mode', async () => {
});

test('nested transaction - rollback', async () => {
const tableName = 'table11';
const tableName = 'table12';
const client = await getClient();

await createTable(client, tableName);
Expand All @@ -196,4 +196,22 @@ describe('explicit mode', async () => {

await checkRows(client, tableName, 0);
});

test('commit twice throws', async () => {
const client = await getClient();
const tx = await client.transaction();
await tx.commit();
await expect(() => tx.commit()).rejects.toThrow(
'Cannot commit a transaction that is not active',
);
});

test('rollback twice throws', async () => {
const client = await getClient();
const tx = await client.transaction();
await tx.rollback();
await expect(() => tx.rollback()).rejects.toThrow(
'Cannot roll back a transaction that is not active',
);
});
});

0 comments on commit 107ffcb

Please sign in to comment.