Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is this library compatible with models defined by Sequelize-Typescript? #90

Open
pandrews-hdai opened this issue Jun 30, 2021 · 1 comment

Comments

@pandrews-hdai
Copy link

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?

@redevill
Copy link

redevill commented Sep 30, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants