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
Running this test gives me this error, meaning the mock for the app module is not working: [Nest] 75665 - 18/10/2022, 17:35:36 ERROR [RedisModule] sipUsers: connect ECONNREFUSED 127.0.0.1:6379
Context
I also run a unit test for the service that uses the Redis module. Here the mock works perfectly.
const module: TestingModule = await Test.createTestingModule({
providers: [
KamailioApiService,
{
provide: ConfigService,
useValue: mockedConfigService,
},
{
provide: getRedisToken('sipUsers'),
useValue: mockedRedisService,
},
loggerProvider(KamailioApiService.name),
],
imports: [HttpModule], // this is just a test to make tests run, dont know if we should mock this here already
}).compile();
So it's weird to me that it doesnt work when mocking it for the root App, But I cant figure out why since I mock other services in the same way for both my unit and e2e tests.
Version used:
NestJS version: 8
Node.js version: 16
The text was updated successfully, but these errors were encountered:
I have the same issue with the latest version of this library. The only references to getRedisToken are in docs and test code. It's not actually used by the modules being created. We cannot override a provider that is never provided.
Expected Behavior
Mocking the Redis provider when running an e2e test should provide a mocked redis instance that does not try connection to a Redis server.
app.module.ts:
app.e2e-spec.ts
Current Behavior
Running this test gives me this error, meaning the mock for the app module is not working:
[Nest] 75665 - 18/10/2022, 17:35:36 ERROR [RedisModule] sipUsers: connect ECONNREFUSED 127.0.0.1:6379
Context
I also run a unit test for the service that uses the Redis module. Here the mock works perfectly.
Redis injected like this in my service:
The mock:
So it's weird to me that it doesnt work when mocking it for the root App, But I cant figure out why since I mock other services in the same way for both my unit and e2e tests.
The text was updated successfully, but these errors were encountered: