Sequelize unit testing with jasmine

1.1k Views Asked by At

I'm currently creating a NodeJS / Angular / Sequelize case study project. So, I bootstraped the project with the yeoman angular generator, and use jasmine / karma for client-side unit testing.

Now that I'm on the server side, I, off course, want to do unit tests for it with the same framework, jasmine, thanks to jasmine-node and rewire.

But I'm relatively new to Sequelize.js, and I'm still trying to find the good way to do the unit testing for my models. Of course, I could do like this answer recommend, but I'm worrying about consistency ...

So, how would you do unit tests, with jasmine-node and rewire, for Sequilize.js ?

For example, for a model :

module.exports = function (sequelize, DataTypes) {
  return sequelize.define('Client', {
    id: {
      type: DataTypes.INTEGER.UNSIGNED,
      primaryKey: true,
      autoIncrement: true
    },
    firstname: DataTypes.STRING,
    lastname: DataTypes.STRING
  });
}

I know there is almost nothing to test here, but this is just for an example.

0

There are 0 best solutions below