32 lines
1.3 KiB
TypeScript
32 lines
1.3 KiB
TypeScript
import { PrismaService } from './prisma.service';
|
|
|
|
describe('PrismaService', () => {
|
|
it('keeps the operation log delegate configurable for transaction client proxies', async () => {
|
|
const prisma = new PrismaService();
|
|
|
|
expect(Object.getOwnPropertyDescriptor(prisma, 'operationLog')).toEqual(
|
|
expect.objectContaining({ configurable: true }),
|
|
);
|
|
expect(prisma.getPoolState()).toEqual({ max: 32, total: 0, idle: 0, waiting: 0 });
|
|
|
|
await prisma.$disconnect();
|
|
});
|
|
|
|
it('reserves a bounded database pool for the isolated Gateway callback process', async () => {
|
|
const previousRole = process.env.CMPP_PROCESS_ROLE;
|
|
const previousMax = process.env.API_CALLBACK_DB_POOL_MAX;
|
|
process.env.CMPP_PROCESS_ROLE = 'callback';
|
|
process.env.API_CALLBACK_DB_POOL_MAX = '12';
|
|
try {
|
|
const prisma = new PrismaService();
|
|
expect(prisma.getPoolState()).toEqual({ max: 12, total: 0, idle: 0, waiting: 0 });
|
|
await prisma.$disconnect();
|
|
} finally {
|
|
if (previousRole === undefined) delete process.env.CMPP_PROCESS_ROLE;
|
|
else process.env.CMPP_PROCESS_ROLE = previousRole;
|
|
if (previousMax === undefined) delete process.env.API_CALLBACK_DB_POOL_MAX;
|
|
else process.env.API_CALLBACK_DB_POOL_MAX = previousMax;
|
|
}
|
|
});
|
|
});
|