Created
June 17, 2020 12:56
-
-
Save kianaditya/47bc5a4e45234ae5c5782ff9a297cb8e 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 { | |
const author = await factories.create('User') | |
const posts = [] | |
for (let index = 0; index < 4; index++) { | |
const post = await factories.create('Post') | |
author.addAuthor(post) | |
posts.push(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