rochejul / sequelize-mocking

Sequelize extension to deal with data-mocking for testing
MIT License
63 stars 26 forks source link

timestamps being returned as string #15

Closed abemedia closed 6 years ago

abemedia commented 6 years ago

I have a timestamp field in my table which I'm trying to mock, however it seems to simply get returned as a string when using sequelize-mocking. It might be an idea to expose transformFixtureDataFn from sequelize-fixtures to do something like the following:

sequelize_fixtures.loadFile('fixtures/users.json', models, {
  transformFixtureDataFn: function (data) {
    if(data.createdAt) {
      data.createdAt = new Date(data.createdAt);
    }
    return data;
  }
})
rochejul commented 6 years ago

Hi @abeMedia

Sure, it seems this is a part of the sequelize fixtures functionalities

I try to give an enhancement for the next release

Regards