BlinkUX / sequelize-mock

A simple mock interface specifically for testing code relying on Sequelize models
https://sequelize-mock.readthedocs.io
MIT License
139 stars 73 forks source link

Docs glitch? require('sequelize-mock')(); #26

Closed martinhbramwell closed 7 years ago

martinhbramwell commented 7 years ago

Your GitHub README getting started instructions state ...

Start by importing the library
 var SequelizeMock = require('sequelize-mock');
Initialize the library as you would Sequelize
 var DBConnectionMock = new SequelizeMock();

... but your ReadTheDocs instructions state ...

Make Fake DB Connection

Because Sequelize Mock is meant ... .... any actual connection data.

 var SequelizeMock = require('sequelize-mock')();
 var dbMock = new SequelizeMock();

If I follow the second version's require, with its trailing function parenthesis, I get the error:

TypeError: Cannot set property 'queryInterface' of undefined
LoveAndCoding commented 7 years ago

Thanks for letting me know about this issue! The correct code should be (as it looks like you noticed):

var SequelizeMock = require('sequelize-mock');
var dbMock = new SequelizeMock();

Looks like I accidentally had the extra () left over from a different version of that example code. I've fixed it and it should go out with our next release.

alanhr commented 7 years ago

Hi @ktsashes , you need fix this problem in doc. :)