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

Function testAsync

test/integration/model.test.js:2589–2616  ·  test/integration/model.test.js::testAsync
()

Source from the content-addressed store, hash-verified

2587 const sequelize = await Support.prepareTransactionTest(this.sequelize);
2588 const User = sequelize.define(class="st">'User', { username: Sequelize.STRING });
2589 const testAsync = async function() {
2590 const t0 = await sequelize.transaction();
2591
2592 await User.create({
2593 username: class="st">'foo'
2594 }, {
2595 transaction: t0
2596 });
2597
2598 const users0 = await User.findAll({
2599 where: {
2600 username: class="st">'foo'
2601 }
2602 });
2603
2604 expect(users0).to.have.length(0);
2605
2606 const users = await User.findAll({
2607 where: {
2608 username: class="st">'foo'
2609 },
2610 transaction: t0
2611 });
2612
2613 expect(users).to.have.length(1);
2614 const t = t0;
2615 return t.rollback();
2616 };
2617 await User.sync({ force: true });
2618 const tasks = [];
2619 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