Skip to content

xudejian/sequelize-fixture

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sequelize Fixture

Build Status

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!