-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Angelo Manganiello
committed
Jan 11, 2020
1 parent
69c7036
commit d9579e7
Showing
5 changed files
with
47 additions
and
45 deletions.
There are no files selected for viewing
43 changes: 22 additions & 21 deletions
43
generators/server/templates/server/e2e/app.e2e-spec.ts.ejs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,32 @@ | ||
import { Test, TestingModule } from '@nestjs/testing'; | ||
import * as request from 'supertest'; | ||
import request = require('supertest'); | ||
import { AppModule } from '../src/app.module'; | ||
import { INestApplication } from '@nestjs/common'; | ||
|
||
describe('App', () => { | ||
let app: INestApplication; | ||
let app: INestApplication; | ||
|
||
beforeEach(async () => { | ||
const moduleFixture: TestingModule = await Test.createTestingModule({ | ||
imports: [AppModule], | ||
}).compile(); | ||
|
||
app = moduleFixture.createNestApplication(); | ||
await app.init(); | ||
}); | ||
|
||
it('/GET info up running', () => { | ||
return request(app.getHttpServer()) | ||
.get('/management/info') | ||
.expect(200) | ||
.expect({ | ||
const infoService = { | ||
'activeProfiles': 'no', | ||
'display-ribbon-on-profiles': 'no', | ||
}); | ||
}); | ||
}; | ||
|
||
|
||
beforeEach(async () => { | ||
const moduleFixture: TestingModule = await Test.createTestingModule({ | ||
imports: [AppModule], | ||
}).compile(); | ||
|
||
app = moduleFixture.createNestApplication(); | ||
await app.init(); | ||
}); | ||
|
||
it('/GET info up running', () => request(app.getHttpServer()) | ||
.get('/management/info') | ||
.expect(200) | ||
.expect(infoService)); | ||
|
||
afterAll(async () => { | ||
await app.close(); | ||
}); | ||
afterAll(async () => { | ||
await app.close(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,5 +5,8 @@ | |
"testRegex": ".e2e-spec.ts$", | ||
"transform": { | ||
"^.+\\.(t|j)s$": "ts-jest" | ||
}, | ||
"globals": { | ||
"NODE_ENV": "test" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters