MCPcopy Create free account
hub / github.com/mikro-orm/mikro-orm / work

Function work

tests/issues/GH1175.test.ts:190–205  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

188 let trx1: Transaction | undefined;
189 let trx2: Transaction | undefined;
190 const work = async () => {
191 await em.transactional(async em => {
192 em1 = em;
193 trx1 = em.getTransactionContext();
194 username = 'nested1';
195 const user = new User(username);
196 em.persist(user);
197 await em.transactional(async em => {
198 em2 = em;
199 trx2 = em.getTransactionContext();
200 username = 'nested2';
201 const user = new User(username);
202 em.persist(user);
203 });
204 });
205 };
206 await expect(work()).resolves.toBeUndefined();
207 expect(beforeTransactionStart).toHaveBeenCalledTimes(2);
208 expect(beforeTransactionStart).toHaveBeenCalledWith(

Callers 1

GH1175.test.tsFile · 0.70

Calls 6

getTransactionContextMethod · 0.80
persistMethod · 0.65
commitMethod · 0.65
rollbackMethod · 0.65
transactionalMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected