sequelize-fixture
v0.1.4
Published
util for building sequelize model fixtures, mostly useful for setting up test data.
Downloads
7
Maintainers
Readme
Sequelize Fixture
Installation
Install from npm registry:
$ npm install sequelize-fixture
Usage
var Sequelize = require('sequelize');
require('sequelize-fixture')(Sequelize);
it('should generate fixture base on define of Model', function () {
var Foo = sequelize.define('Foo', {
title: Sequelize.STRING(64),
string: Sequelize.STRING,
text: Sequelize.TEXT,
bool: Sequelize.BOOLEAN,
num: Sequelize.INTEGER,
bignum: Sequelize.BIGINT,
float: Sequelize.FLOAT,
date: Sequelize.DATE,
uuid: Sequelize.UUID,
});
var fixture = Foo.fixtures();
assert.ok(fixture.title);
assert.ok(fixture.string);
assert.ok(fixture.text);
assert.equal(typeof fixture.bool, 'boolean');
assert.ok(fixture.num);
assert.ok(fixture.bignum);
assert.ok(fixture.float);
assert.ok(fixture.date);
assert.ok(fixture.uuid);
});
more usage see my test
datatypes_test model_test associate_test
Pull Request Welcome
Thank you!