File tree Expand file tree Collapse file tree
packages/adapter-mssql/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,8 +26,8 @@ vi.mock('mssql', () => {
2626 }
2727} )
2828
29- describe ( 'PrismaMssqlAdapter transaction regression ' , ( ) => {
30- it ( 'should reproduce EREQINPROG when rollback is called during active query' , async ( ) => {
29+ describe ( 'PrismaMssqlAdapter: rollback during active query (EREQINPROG prevention) ' , ( ) => {
30+ it ( 'does not throw EREQINPROG when rollback is called during an active query' , async ( ) => {
3131 // Setup mock behavior
3232 let requestActive = false
3333 let queryStartedResolve : ( ) => void
@@ -59,6 +59,7 @@ describe('PrismaMssqlAdapter transaction regression', () => {
5959 password : 'Password123' ,
6060 database : 'test' ,
6161 } )
62+
6263 pool . transaction = ( ) =>
6364 ( {
6465 on : ( ) => { } ,
@@ -70,7 +71,7 @@ describe('PrismaMssqlAdapter transaction regression', () => {
7071 query : queryMock ,
7172 arrayRowMode : false ,
7273 } ) ,
73- } ) as any
74+ } ) as unknown as sql . Transaction
7475
7576 const adapter = new PrismaMssqlAdapter ( pool )
7677 const tx = await adapter . startTransaction ( )
@@ -87,5 +88,9 @@ describe('PrismaMssqlAdapter transaction regression', () => {
8788 await expect ( rollbackPromise ) . resolves . toBeUndefined ( )
8889
8990 await queryPromise
91+
92+ expect ( queryMock ) . toHaveBeenCalledTimes ( 1 )
93+ expect ( rollbackMock ) . toHaveBeenCalledTimes ( 1 )
94+ expect ( requestActive ) . toBe ( false )
9095 } )
9196} )
You can’t perform that action at this time.
0 commit comments