Last active
July 1, 2020 11:20
-
-
Save kianaditya/f5aa07f62a2cdf69ae78704419c13ef3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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