You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now that I've spent the better part of a week debugging various issues and trying to find examples for injecting mocked models into repositories and just not having any luck getting sequelize to accept the mocks and even complete testing module initialization...I'm beginning to wonder if this library just can't be used with models defined as classes with decorators from sequelize-typescript?
First I was getting a lot of Model not initialized: MyModel cannot be instantiated. "MyModel" needs to be added to a Sequelize instance.
But in attempting to actually do that I started getting TypeError: this.lib.Database is not a constructor, which seems like it's coming out of the sequelize code itself trying to use a real ConnectionManager rather than the validation-only fake ConnectionManager and Dialect I setup using a Sequelize class imported from sequelize-typescript.
Is it possible that mocked models provided by this library just don't know about the wrappers provided by sequelize-typescript and are trying to use sequelize directly but can't?
The text was updated successfully, but these errors were encountered:
Struggling with the same issue - sequelize-typescript with repository mode, and trying to mock out sequelize repository objects. Seems to be far more info out there on Integration testing (Using supertest with a test database, and leveraging sequelize cli to reset the database with each test.) rather than unit test of just the API handler function.
Now that I've spent the better part of a week debugging various issues and trying to find examples for injecting mocked models into repositories and just not having any luck getting sequelize to accept the mocks and even complete testing module initialization...I'm beginning to wonder if this library just can't be used with models defined as classes with decorators from sequelize-typescript?
First I was getting a lot of
Model not initialized: MyModel cannot be instantiated. "MyModel" needs to be added to a Sequelize instance.
But in attempting to actually do that I started getting
TypeError: this.lib.Database is not a constructor
, which seems like it's coming out of the sequelize code itself trying to use a real ConnectionManager rather than the validation-only fake ConnectionManager and Dialect I setup using a Sequelize class imported from sequelize-typescript.Is it possible that mocked models provided by this library just don't know about the wrappers provided by sequelize-typescript and are trying to use sequelize directly but can't?
The text was updated successfully, but these errors were encountered: