From 1e7c594e720a56c973f6a18435c7e848841bd35f Mon Sep 17 00:00:00 2001 From: Ivan Date: Wed, 24 Feb 2021 10:53:49 +0800 Subject: [PATCH] =?UTF-8?q?test:=20=E8=B7=91=E9=80=9A=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E7=94=A8=E4=BE=8B=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/projects/projects.resolver.spec.ts | 9 ++++++++- src/projects/projects.service.spec.ts | 10 +++++++++- src/repos/repos.resolver.spec.ts | 9 ++++++++- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/projects/projects.resolver.spec.ts b/src/projects/projects.resolver.spec.ts index 0a93e17..b69ff2b 100644 --- a/src/projects/projects.resolver.spec.ts +++ b/src/projects/projects.resolver.spec.ts @@ -1,12 +1,19 @@ import { Test, TestingModule } from '@nestjs/testing'; import { ProjectsResolver } from './projects.resolver'; +import { ProjectsService } from './projects.service'; describe('ProjectsResolver', () => { let resolver: ProjectsResolver; beforeEach(async () => { const module: TestingModule = await Test.createTestingModule({ - providers: [ProjectsResolver], + providers: [ + ProjectsResolver, + { + provide: ProjectsService, + useValue: {}, + }, + ], }).compile(); resolver = module.get(ProjectsResolver); diff --git a/src/projects/projects.service.spec.ts b/src/projects/projects.service.spec.ts index d3b3101..be02cbd 100644 --- a/src/projects/projects.service.spec.ts +++ b/src/projects/projects.service.spec.ts @@ -1,12 +1,20 @@ import { Test, TestingModule } from '@nestjs/testing'; import { ProjectsService } from './projects.service'; +import { getRepositoryToken } from '@nestjs/typeorm'; +import { Project } from './project.entity'; describe('ProjectsService', () => { let service: ProjectsService; beforeEach(async () => { const module: TestingModule = await Test.createTestingModule({ - providers: [ProjectsService], + providers: [ + ProjectsService, + { + provide: getRepositoryToken(Project), + useValue: {}, + }, + ], }).compile(); service = module.get(ProjectsService); diff --git a/src/repos/repos.resolver.spec.ts b/src/repos/repos.resolver.spec.ts index e8b3711..a8af1ba 100644 --- a/src/repos/repos.resolver.spec.ts +++ b/src/repos/repos.resolver.spec.ts @@ -1,12 +1,19 @@ import { Test, TestingModule } from '@nestjs/testing'; import { ReposResolver } from './repos.resolver'; +import { ReposService } from './repos.service'; describe('ReposResolver', () => { let resolver: ReposResolver; beforeEach(async () => { const module: TestingModule = await Test.createTestingModule({ - providers: [ReposResolver], + providers: [ + ReposResolver, + { + provide: ReposService, + useValue: {}, + }, + ], }).compile(); resolver = module.get(ReposResolver);