Initial commit: add .gitignore and README
This commit is contained in:
22
tests/unit/transaction-manager.test.ts
Normal file
22
tests/unit/transaction-manager.test.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { TransactionManager } from '../../src/database/transaction-manager';
|
||||
|
||||
describe('TransactionManager', () => {
|
||||
describe('executeInTransaction', () => {
|
||||
it('should commit transaction on success', async () => {
|
||||
const result = await TransactionManager.executeInTransaction(async (_client) => {
|
||||
// Mock transaction
|
||||
return { success: true };
|
||||
});
|
||||
|
||||
expect(result).toEqual({ success: true });
|
||||
});
|
||||
|
||||
it('should rollback transaction on error', async () => {
|
||||
await expect(
|
||||
TransactionManager.executeInTransaction(async (_client) => {
|
||||
throw new Error('Test error');
|
||||
})
|
||||
).rejects.toThrow('Test error');
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user