Closed StephanHoyer closed 9 years ago
We need to mock knex prior to it be initiated. Not knowing your setup here is an example of what will and won't work
WIll Work;
mockDB.knex.install();
var db = knex({
client : 'sqlite3'
});
Won't work;
var db = knex({
client : 'sqlite3'
});
mockDB.knex.install();
Also the following only needs to be called once;
mockDB.knex.use(knex);
mockDB.knex.install();
Trackers can be installed and uninstalled on tests to avoid processing other tests responses.
I can't reach out to the initialisation of db, other tests that may run prior this test may invoke it.
Sorry, but I don't use mock-knex anymore. Tried it at least 4 times to get this running.
I now monkey-patch the prototype of my models which seem to work fine.
I want to use your lib to mock my bookshelf models.
I did the following.
The models are still not mocked and fire normal queries. Seems like the creation of the bookshelft base model and of the models happens prior the mocking what causes it not to work properly.
What I'm doing wrong here?