MCPcopy
hub / github.com/sequelize/sequelize / createUsersAndItems

Function createUsersAndItems

test/integration/include.test.js:786–816  ·  test/integration/include.test.js::createUsersAndItems
()

Source from the content-addressed store, hash-verified

784 });
785
786 const createUsersAndItems = async function() {
787 const User = this.sequelize.define(class="st">'User', {}),
788 Item = this.sequelize.define(class="st">'Item', { class="st">'test': DataTypes.STRING });
789
790 User.hasOne(Item);
791 Item.belongsTo(User);
792
793 this.User = User;
794 this.Item = Item;
795
796 await this.sequelize.sync({ force: true });
797
798 const [users, items] = await Promise.all([
799 User.bulkCreate([{}, {}, {}]).then(() => {
800 return User.findAll();
801 }),
802 Item.bulkCreate([
803 { class="st">'test': class="st">'abc' },
804 { class="st">'test': class="st">'def' },
805 { class="st">'test': class="st">'ghi' }
806 ]).then(() => {
807 return Item.findAll();
808 })
809 ]);
810
811 return Promise.all([
812 users[0].setItem(items[0]),
813 users[1].setItem(items[1]),
814 users[2].setItem(items[2])
815 ]);
816 };
817
818 describe(class="st">'where', () => {
819 beforeEach(async function() {

Callers

nothing calls this directly

Calls 7

defineMethod · 0.80
hasOneMethod · 0.80
belongsToMethod · 0.80
allMethod · 0.80
bulkCreateMethod · 0.80
findAllMethod · 0.80
syncMethod · 0.45

Tested by

no test coverage detected