Skip to content

Commit

Permalink
feat(pmp-api): add pmp-api-e2e application
Browse files Browse the repository at this point in the history
close #40
  • Loading branch information
MaciejSikorski committed Dec 16, 2019
1 parent f9c98a1 commit 71ba530
Show file tree
Hide file tree
Showing 10 changed files with 166 additions and 0 deletions.
26 changes: 26 additions & 0 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,32 @@
}
}
},
"pmp-api-e2e": {
"root": "apps/pmp-api-e2e",
"sourceRoot": "apps/pmp-api-e2e/src",
"projectType": "application",
"prefix": "pmp-api-e2e",
"schematics": {},
"architect": {
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"apps/pmp-api-e2e/tsconfig.app.json",
"apps/pmp-api-e2e/tsconfig.spec.json"
],
"exclude": ["**/node_modules/**", "!apps/pmp-api-e2e/**"]
}
},
"e2e": {
"builder": "@nrwl/jest:jest",
"options": {
"jestConfig": "apps/pmp-api-e2e/jest.config.js",
"tsConfig": "apps/pmp-api-e2e/tsconfig.spec.json"
}
}
}
},
"pmp-web-shell": {
"projectType": "library",
"root": "libs/pmp-web/shell",
Expand Down
28 changes: 28 additions & 0 deletions apps/pmp-api-e2e/integration/app.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import * as request from 'supertest';
import { Test } from '@nestjs/testing';
import { INestApplication } from '@nestjs/common';
// tslint:disable-next-line TODO to remove, disable only to show proposal of usage
import { AppModule } from '../../pmp-api/src/app/app.module';

describe('Application', () => {
let app: INestApplication;

beforeAll(async () => {
const module = await Test.createTestingModule({
imports: [AppModule]
}).compile();

app = module.createNestApplication();
await app.init();
});

it(`/GET hello`, () => {
return request(app.getHttpServer())
.get('/hello')
.expect(200, 'Welcome to api!');
});

afterAll(async () => {
await app.close();
});
});
5 changes: 5 additions & 0 deletions apps/pmp-api-e2e/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
name: 'pmp-api-e2e',
preset: '../../jest.config.js',
coverageDirectory: '../../coverage/apps/pmp-api-e2e'
};
9 changes: 9 additions & 0 deletions apps/pmp-api-e2e/tsconfig.app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"types": ["node"]
},
"exclude": ["**/*.spec.ts"],
"include": ["**/*.ts"]
}
7 changes: 7 additions & 0 deletions apps/pmp-api-e2e/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"types": ["node", "jest"]
},
"include": ["**/*.ts"]
}
9 changes: 9 additions & 0 deletions apps/pmp-api-e2e/tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"types": ["jest", "node"]
},
"include": ["**/*.spec.ts", "**/*.d.ts"]
}
1 change: 1 addition & 0 deletions apps/pmp-api-e2e/tslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "extends": "../../tslint.json", "rules": [] }
3 changes: 3 additions & 0 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
"pmp-api": {
"tags": ["type:application", "scope:pmp-api"]
},
"pmp-api-e2e": {
"tags": ["type:application", "scope:pmp-api"]
},
"pmp-web-shell": {
"tags": ["scope:pmp-web", "type:shell"]
}
Expand Down
76 changes: 76 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"@nrwl/workspace": "8.7.1",
"@types/jest": "24.0.9",
"@types/node": "~8.9.4",
"@types/supertest": "^2.0.8",
"@valueadd/dev": "^4.0.0",
"codelyzer": "~5.0.1",
"cypress": "3.4.1",
Expand All @@ -71,6 +72,7 @@
"jest": "24.1.0",
"jest-preset-angular": "7.0.0",
"prettier": "1.18.2",
"supertest": "latest",
"ts-jest": "24.0.0",
"ts-node": "~7.0.0",
"tslint": "~5.11.0",
Expand Down

0 comments on commit 71ba530

Please sign in to comment.