фон
При передаче тестового кода с помощью ci при создании программы с гнездом. js
Я получил эту ошибку
expect(received).toBeDefined()
Received: undefined
Nest can't resolve dependencies of the ProfilesService (?). Please make sure that the argument PatientProfileRepository at index [0] is available in the RootTestModule context.
Проблемы, неизвестные точки
describe('ProfilesService', () => {
let service: ProfilesService
beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
providers: [ProfilesService],
}).compile()
service = module.get<ProfilesService>(ProfilesService)
})
it('should be defined', () => {
expect(service).toBeDefined()
})
})
Контроллер имеет похожий код
import { Test, TestingModule } from '@nestjs/testing'
import ProfilesController from './profiles.controller'
describe('Profiles Controller', () => {
let controller: ProfilesController
beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
controllers: [ProfilesController],
}).compile()
controller = module.get<ProfilesController>(ProfilesController)
})
it('should be defined', () => {
expect(controller).toBeDefined()
})
})
Я не знаю, почему контроллер и служба несут ответственность за неопределенность. Я рад, если кто-нибудь может сказать мне. Спасибо