test: 跑通测试用例。
This commit is contained in:
parent
42c389b913
commit
1e7c594e72
@ -1,12 +1,19 @@
|
|||||||
import { Test, TestingModule } from '@nestjs/testing';
|
import { Test, TestingModule } from '@nestjs/testing';
|
||||||
import { ProjectsResolver } from './projects.resolver';
|
import { ProjectsResolver } from './projects.resolver';
|
||||||
|
import { ProjectsService } from './projects.service';
|
||||||
|
|
||||||
describe('ProjectsResolver', () => {
|
describe('ProjectsResolver', () => {
|
||||||
let resolver: ProjectsResolver;
|
let resolver: ProjectsResolver;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
const module: TestingModule = await Test.createTestingModule({
|
const module: TestingModule = await Test.createTestingModule({
|
||||||
providers: [ProjectsResolver],
|
providers: [
|
||||||
|
ProjectsResolver,
|
||||||
|
{
|
||||||
|
provide: ProjectsService,
|
||||||
|
useValue: {},
|
||||||
|
},
|
||||||
|
],
|
||||||
}).compile();
|
}).compile();
|
||||||
|
|
||||||
resolver = module.get<ProjectsResolver>(ProjectsResolver);
|
resolver = module.get<ProjectsResolver>(ProjectsResolver);
|
||||||
|
@ -1,12 +1,20 @@
|
|||||||
import { Test, TestingModule } from '@nestjs/testing';
|
import { Test, TestingModule } from '@nestjs/testing';
|
||||||
import { ProjectsService } from './projects.service';
|
import { ProjectsService } from './projects.service';
|
||||||
|
import { getRepositoryToken } from '@nestjs/typeorm';
|
||||||
|
import { Project } from './project.entity';
|
||||||
|
|
||||||
describe('ProjectsService', () => {
|
describe('ProjectsService', () => {
|
||||||
let service: ProjectsService;
|
let service: ProjectsService;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
const module: TestingModule = await Test.createTestingModule({
|
const module: TestingModule = await Test.createTestingModule({
|
||||||
providers: [ProjectsService],
|
providers: [
|
||||||
|
ProjectsService,
|
||||||
|
{
|
||||||
|
provide: getRepositoryToken(Project),
|
||||||
|
useValue: {},
|
||||||
|
},
|
||||||
|
],
|
||||||
}).compile();
|
}).compile();
|
||||||
|
|
||||||
service = module.get<ProjectsService>(ProjectsService);
|
service = module.get<ProjectsService>(ProjectsService);
|
||||||
|
@ -1,12 +1,19 @@
|
|||||||
import { Test, TestingModule } from '@nestjs/testing';
|
import { Test, TestingModule } from '@nestjs/testing';
|
||||||
import { ReposResolver } from './repos.resolver';
|
import { ReposResolver } from './repos.resolver';
|
||||||
|
import { ReposService } from './repos.service';
|
||||||
|
|
||||||
describe('ReposResolver', () => {
|
describe('ReposResolver', () => {
|
||||||
let resolver: ReposResolver;
|
let resolver: ReposResolver;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
const module: TestingModule = await Test.createTestingModule({
|
const module: TestingModule = await Test.createTestingModule({
|
||||||
providers: [ReposResolver],
|
providers: [
|
||||||
|
ReposResolver,
|
||||||
|
{
|
||||||
|
provide: ReposService,
|
||||||
|
useValue: {},
|
||||||
|
},
|
||||||
|
],
|
||||||
}).compile();
|
}).compile();
|
||||||
|
|
||||||
resolver = module.get<ReposResolver>(ReposResolver);
|
resolver = module.get<ReposResolver>(ReposResolver);
|
||||||
|
Loading…
Reference in New Issue
Block a user