Текущее поведение
Nest can't resolve dependencies of the ElasticsearchService (?). Please make sure that the argument at index [0] is available in the ElasticsearchModule context.
Ожидаемое поведение
Создание службы ElasticSearchService в тестовом модуле
Минимальное воспроизведение проблемы с инструкциями
import { Test, TestingModule } from '@nestjs/testing';
import { RepliesController } from './replies.controller';
import { ElasticsearchService, ElasticsearchModule } from '@nestjs/elasticsearch';
import { Client } from 'elasticsearch';
describe('Replies Controller', () => {
let module: TestingModule;
let elasticsearch: ElasticsearchService;
beforeAll(async () => {
module = await Test.createTestingModule({
imports: [ElasticsearchModule],
controllers: [RepliesController],
components: [ElasticsearchService, {provide: Client, useValue: {}}],
}).compile();
elasticsearch = module.get<ElasticsearchService>(ElasticsearchService);
});
it('should be defined', () => {
const controller: RepliesController = module.get<RepliesController>(RepliesController);
expect(controller).toBeDefined();
});
});
Среда
[Nest Information]
elasticsearch version : 0.1.2
common version : 5.4.0
core version : 5.4.0