()
| 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 | }); |
nothing calls this directly
no test coverage detected