-
-
Notifications
You must be signed in to change notification settings - Fork 381
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Is there an existing issue for this?
- I have searched the existing issues
Feature Test To Be Requested
The sequelize-sample is really awesome, but we're using Sequelize Transactions in our codebase and by doing so we have to mock the Sequelize transaction()
method or Nest will throw dependency errors:
Nest can't resolve dependencies of the CatService (CatEntityRepository, ?). Please make sure that the argument Sequelize at index [5] is available in the RootTestModule context.
Potential solutions:
- Is RootTestModule a valid NestJS module?
- If Sequelize is a provider, is it part of the current RootTestModule?
- If Sequelize is exported from a separate @Module, is that module imported within RootTestModule?
@Module({
imports: [ /* the Module containing Sequelize */ ]
})
I've looked through the NestJS documentation and Discord but I couldn't find any good examples of how to do this because if I mock the Sequelize transaction like this, I don't get the value from my service call:
{
provide: Sequelize,
useValue: {
transaction: jest.fn(() => Promise.resolve()),
},
},
The Nest docs state to use a helper factory class but I couldn't find a good example of this either.
1111mp
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request