| 402 | if (current.dialect.supports.transactions) { |
| 403 | it(class="st">'should release transaction when meeting errors', async function() { |
| 404 | const test = async times => { |
| 405 | if (times > 10) { |
| 406 | return true; |
| 407 | } |
| 408 | |
| 409 | try { |
| 410 | return await pTimeout(this.Student.findOrCreate({ |
| 411 | where: { |
| 412 | no: 1 |
| 413 | } |
| 414 | }), 1000); |
| 415 | } catch (e) { |
| 416 | if (e instanceof Sequelize.ValidationError) return test(times + 1); |
| 417 | if (e instanceof pTimeout.TimeoutError) throw new Error(e); |
| 418 | throw e; |
| 419 | } |
| 420 | }; |
| 421 | |
| 422 | await test(0); |
| 423 | }); |
no test coverage detected