MCPcopy
hub / github.com/sequelize/sequelize / testAsync

Function testAsync

test/integration/model.test.js:2610–2637  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2608 const sequelize = await Support.prepareTransactionTest(this.sequelize);
2609 const User = sequelize.define('User', { username: Sequelize.STRING });
2610 const testAsync = async function() {
2611 const t0 = await sequelize.transaction();
2612
2613 await User.create({
2614 username: 'foo'
2615 }, {
2616 transaction: t0
2617 });
2618
2619 const users0 = await User.findAll({
2620 where: {
2621 username: 'foo'
2622 }
2623 });
2624
2625 expect(users0).to.have.length(0);
2626
2627 const users = await User.findAll({
2628 where: {
2629 username: 'foo'
2630 },
2631 transaction: t0
2632 });
2633
2634 expect(users).to.have.length(1);
2635 const t = t0;
2636 return t.rollback();
2637 };
2638 await User.sync({ force: true });
2639 const tasks = [];
2640 for (let i = 0; i < 1000; i++) {

Callers

nothing calls this directly

Calls 4

transactionMethod · 0.80
findAllMethod · 0.80
rollbackMethod · 0.80
createMethod · 0.45

Tested by

no test coverage detected