-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
integration(@nestjs) add typeorm integration test
- Loading branch information
1 parent
17a609c
commit 7b5b054
Showing
20 changed files
with
2,263 additions
and
13 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# dependencies | ||
/node_modules | ||
|
||
# IDE | ||
/.idea | ||
/.awcache | ||
/.vscode | ||
|
||
# misc | ||
npm-debug.log | ||
|
||
# example | ||
/quick-start | ||
|
||
# tests | ||
/test | ||
/coverage | ||
/.nyc_output | ||
|
||
# dist | ||
/dist |
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { INestApplication } from '@nestjs/common'; | ||
import { Test } from '@nestjs/testing'; | ||
import * as request from 'supertest'; | ||
import { ApplicationModule } from './../src/app.module'; | ||
|
||
describe('TypeOrm', () => { | ||
let server; | ||
let app: INestApplication; | ||
|
||
beforeEach(async () => { | ||
const module = await Test.createTestingModule({ | ||
imports: [ApplicationModule], | ||
}).compile(); | ||
|
||
app = module.createNestApplication(); | ||
server = app.getHttpServer(); | ||
await app.init(); | ||
}); | ||
|
||
it(`should return created entity`, () => { | ||
return request(server) | ||
.post('/photo') | ||
.expect(201, { name: 'Nest', description: 'Is great!', views: 6000 }); | ||
}); | ||
|
||
afterEach(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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"type": "mysql", | ||
"host": "localhost", | ||
"port": 3306, | ||
"username": "root", | ||
"password": "root", | ||
"database": "test", | ||
"entities": ["src/**/**.entity{.ts,.js}"], | ||
"synchronize": true | ||
} |
Oops, something went wrong.