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

Function createUsersAndItems

test/integration/include.test.js:791–821  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

789 });
790
791 const createUsersAndItems = async function() {
792 const User = this.sequelize.define('User', {}),
793 Item = this.sequelize.define('Item', { 'test': DataTypes.STRING });
794
795 User.hasOne(Item);
796 Item.belongsTo(User);
797
798 this.User = User;
799 this.Item = Item;
800
801 await this.sequelize.sync({ force: true });
802
803 const [users, items] = await Promise.all([
804 User.bulkCreate([{}, {}, {}]).then(() => {
805 return User.findAll();
806 }),
807 Item.bulkCreate([
808 { 'test': 'abc' },
809 { 'test': 'def' },
810 { 'test': 'ghi' }
811 ]).then(() => {
812 return Item.findAll();
813 })
814 ]);
815
816 return Promise.all([
817 users[0].setItem(items[0]),
818 users[1].setItem(items[1]),
819 users[2].setItem(items[2])
820 ]);
821 };
822
823 describe('where', () => {
824 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