Skip to content

Instantly share code, notes, and snippets.

@kianaditya
Last active June 17, 2020 12:21
Show Gist options
  • Save kianaditya/db7adc01df054a0d4bd0896614ba4369 to your computer and use it in GitHub Desktop.
Save kianaditya/db7adc01df054a0d4bd0896614ba4369 to your computer and use it in GitHub Desktop.
medium express second article
const factoryGirl = require('factory-girl')
const adapter = new factoryGirl.SequelizeAdapter()
const factory = factoryGirl.factory
factory.setAdapter(adapter)
factory.cleanUp()
const db = require('../../src/models')
factory.define('Post', db.Post, async () => {
const attrs = {
id: factory.seq('Post.id'),
title: factory.chance('sentence', { words: 5 }),
content: factory.chance('sentence', { words: 15 }),
}
return attrs
})
module.exports = factory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment