Jest trouble shooting

broccoli·2021년 8월 23일
0

jest

목록 보기
1/1
post-thumbnail

1. Nest can't resolve dependencies of the MoviesController (?). Please make sure that the argument MoviesService at index [0] is available in the RootTestModule context.

export class MoviesController {
  constructor(private readonly moviesService: MoviesService) {}
  ...
}

controller 안에 이와 같이 서버스를 주입했을 때는 jest test시

    const module: TestingModule = await Test.createTestingModule({
      controllers: [MoviesController],
      providers: [MoviesService],
    }).compile();

위와 같이 provider로 제공을 해줘야한다.

profile
🌃브로콜리한 개발자🌟

0개의 댓글

관련 채용 정보