| 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() { |