Skip to content

Instantly share code, notes, and snippets.

@kianaditya
Last active July 1, 2020 11:20
Show Gist options
  • Save kianaditya/f5aa07f62a2cdf69ae78704419c13ef3 to your computer and use it in GitHub Desktop.
Save kianaditya/f5aa07f62a2cdf69ae78704419c13ef3 to your computer and use it in GitHub Desktop.
const factories = require('../factories')
const db = require('../../src/models')
before(async function () {
try {
factories.cleanUp()
const author = await factories.create('User',{email: '[email protected]'})
const author2 = await factories.create('User',{email: '[email protected]'})
for (let index = 0; index < 4; index++) {
const post = await factories.create('Post')
author.addWritten(post)
}
for (let index = 0; index < 4; index++) {
const post = await factories.create('Post')
author2.addWritten(post)
}
} catch (error) {
console.error(error)
}
})
after(async function () {
await db.sequelize.sync({ force: true })
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment