nest-modules / ioredis

:see_no_evil: :hear_no_evil: :speak_no_evil: A ioredis module for Nest framework (node.js)
MIT License
145 stars 31 forks source link

Redis is not defined when i test my services #259

Closed mohametdiatta closed 10 months ago

mohametdiatta commented 1 year ago

How can i the redis instance in my unit test

joachimbulow commented 1 year ago

Bump

joachimbulow commented 1 year ago

I suppose you could service, inject redis into that, and go through that interface, however we would like to directly inject a redis instance into our E2E tests instead.

juandav commented 10 months ago

We can create a discussion about it in the discussions section.

joachimbulow commented 10 months ago

A bit specific, but in case anyone can use it:

By having access to the compiled module in the init method of our test suites:

const builder = Test.createTestingModule({ imports: [AppModule], }); ... const module: TestingModule = await builder.compile();

We could get access to redis with by using the getRedisToken from @songkeys/nestjs-redis:

module.get(getRedisToken('default'));