bugfix: fix broken unit test example

This commit is contained in:
Kamil Myśliwiec 2018-04-28 18:04:45 +02:00
parent 7b918538db
commit 52e1cc679a
4 changed files with 145 additions and 539 deletions

678
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -12,6 +12,7 @@
"start:hmr": "node dist/server", "start:hmr": "node dist/server",
"lint": "tslint -p tsconfig.json -c tslint.json", "lint": "tslint -p tsconfig.json -c tslint.json",
"test": "jest", "test": "jest",
"test:watch": "jest --watch",
"test:cov": "jest --coverage", "test:cov": "jest --coverage",
"test:e2e": "jest --config ./test/jest-e2e.json", "test:e2e": "jest --config ./test/jest-e2e.json",
"webpack": "webpack --config webpack.config.js" "webpack": "webpack --config webpack.config.js"
@ -22,6 +23,7 @@
"@nestjs/microservices": "^5.0.0", "@nestjs/microservices": "^5.0.0",
"@nestjs/testing": "^5.0.0", "@nestjs/testing": "^5.0.0",
"@nestjs/websockets": "^5.0.0", "@nestjs/websockets": "^5.0.0",
"reflect-metadata": "^0.1.12",
"rxjs": "^5.5.6", "rxjs": "^5.5.6",
"typescript": "^2.6.2" "typescript": "^2.6.2"
}, },

View File

@ -1,6 +1,7 @@
import { Test, TestingModule } from '@nestjs/testing'; import { Test, TestingModule } from '@nestjs/testing';
import { INestApplication } from '@nestjs/common'; import { INestApplication } from '@nestjs/common';
import { AppController } from './app.controller'; import { AppController } from './app.controller';
import { AppService } from './app.service';
describe('AppController', () => { describe('AppController', () => {
let app: TestingModule; let app: TestingModule;
@ -8,6 +9,7 @@ describe('AppController', () => {
beforeAll(async () => { beforeAll(async () => {
app = await Test.createTestingModule({ app = await Test.createTestingModule({
controllers: [AppController], controllers: [AppController],
providers: [AppService],
}).compile(); }).compile();
}); });

View File

@ -15,7 +15,7 @@ describe('AppController (e2e)', () => {
await app.init(); await app.init();
}); });
it('/GET /', () => { it('/ (GET)', () => {
return request(app.getHttpServer()) return request(app.getHttpServer())
.get('/') .get('/')
.expect(200) .expect(200)