Add test for doInNewTransaction (mysql)
This commit is contained in:
parent
76bf7d8d47
commit
359c6afd08
@ -2,7 +2,7 @@ import express from 'express'
|
|||||||
import supertest from 'supertest'
|
import supertest from 'supertest'
|
||||||
import {Connection, QueryRunner} from 'typeorm'
|
import {Connection, QueryRunner} from 'typeorm'
|
||||||
import {
|
import {
|
||||||
ENTITY_MANAGER, ITransactionManager,
|
ENTITY_MANAGER, ITransactionManager, TRANSACTION_ID,
|
||||||
} from '../database/ITransactionManager'
|
} from '../database/ITransactionManager'
|
||||||
import {IRoutes} from '@rondo.dev/common'
|
import {IRoutes} from '@rondo.dev/common'
|
||||||
import {IBootstrap} from '../application/IBootstrap'
|
import {IBootstrap} from '../application/IBootstrap'
|
||||||
@ -44,7 +44,7 @@ export class TestUtils<T extends IRoutes> {
|
|||||||
connection = await database.connect()
|
connection = await database.connect()
|
||||||
queryRunner = connection.createQueryRunner()
|
queryRunner = connection.createQueryRunner()
|
||||||
await queryRunner.connect()
|
await queryRunner.connect()
|
||||||
namespace.set(CORRELATION_ID, shortid())
|
namespace.set(TRANSACTION_ID, shortid())
|
||||||
await queryRunner.startTransaction()
|
await queryRunner.startTransaction()
|
||||||
namespace.set(ENTITY_MANAGER, queryRunner.manager)
|
namespace.set(ENTITY_MANAGER, queryRunner.manager)
|
||||||
})
|
})
|
||||||
@ -55,7 +55,7 @@ export class TestUtils<T extends IRoutes> {
|
|||||||
await queryRunner.rollbackTransaction()
|
await queryRunner.rollbackTransaction()
|
||||||
}
|
}
|
||||||
await queryRunner.release()
|
await queryRunner.release()
|
||||||
namespace.set(CORRELATION_ID, undefined)
|
namespace.set(TRANSACTION_ID, undefined)
|
||||||
namespace.set(ENTITY_MANAGER, undefined)
|
namespace.set(ENTITY_MANAGER, undefined)
|
||||||
await connection.close();
|
await connection.close();
|
||||||
(namespace as any).exit(context)
|
(namespace as any).exit(context)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user