-
Notifications
You must be signed in to change notification settings - Fork 72
Open
Labels
Description
I feel like I'm being an idiot :), but I've setup my test as close to the docs as possible, yet I'm getting an TypeError: User.$useHandler is not a function error any time I try to run tests. I've dug through the code trying see if I'm using it at the right place and I'm stuck. Any help is appreciated, the library looks super useful!
var SequelizeMock = require('sequelize-mock');
var dbMock = new SequelizeMock();
var User = dbMock.define('User', {
title: 'hi',
});
User.$useHandler(function(query, queryOptions, done) {
if (query === "findOne") {
return Promise.resolve('test');
} else if (query === "destroy") {
return Promise.reject(new SequelizeMock.Error("DB down"));
} else {
// This handler can handle this query
return;
}
});
PaulRBerg, dalexander-trc, raciat, nyan2x, kyle-swanson and 2 more