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
Sequelize-typescript with jest.js tests #688
Comments
Hey @grzegorzCieslik95 thanks for bringing this up! You could create another sequelize instance just for testing purposes with option new Sequelize({
validateOnly: true,
models: [__dirname + '/models'] // don't forget to add your models like this... or [User, ...]
}); With Hope this helps! Maybe it would be better to provide an option, which is exclusively defined for testing purposes like |
Hi @RobinBuschmann ! Have a nice day :) |
Closing this due to inactivity |
Running into this same issue, using ts-jest as a preprocessor. I've tried with |
Did you manage to resolve this, can't find a solution anywhere? |
Hi,
I hope it will help you with your issue |
Hello, I've tried the first solution with setting |
I solved this issue by creating a mock/fake
|
@yatin166 As far as I can see If that's correct any dialect/database/username/password specified alongside validateOnly doesn't matter. I still seem to have the |
A lot of time has passed. Were you able to solve it? I'm currently facing this exact same issue. I'm trying to pass to a Service Class a fake Sequelize instance to use transactions and been a lot of time struggling with it. |
@gusparr28 I don't know about anyone else but unfortunately I wasn't able to get anything to work with mocking models. |
Versions
I'm submitting a ...
[ ] bug report
[X] feature request
Hi,
Do you have any idea, how should I mock Sequalize class in tests in this case?
I have repository
When I try to create a new instance of User I got an error like that
Do you have any idea, how can I fix this problem?
The text was updated successfully, but these errors were encountered: