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

Function work

tests/issues/GH1176.test.ts:111–120  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

109 it('commit throws when a database constraint fails', async () => {
110 await em.begin();
111 const work = async () => {
112 try {
113 const user = new User(username);
114 em.persist(user);
115 await em.commit();
116 } catch (error) {
117 await em.rollback();
118 throw error;
119 }
120 };
121
122 await expect(work).rejects.toThrow(/duplicate key value/);
123 });

Callers

nothing calls this directly

Calls 4

persistMethod · 0.65
commitMethod · 0.65
rollbackMethod · 0.65
transactionalMethod · 0.45

Tested by

no test coverage detected