Skip to content

Commit

Permalink
feat(pmp-api): create app for backend e2e
Browse files Browse the repository at this point in the history
close #40
  • Loading branch information
MaciejSikorski committed Dec 13, 2019
1 parent a2d3c1a commit 5d9f375
Show file tree
Hide file tree
Showing 10 changed files with 140 additions and 1 deletion.
26 changes: 26 additions & 0 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,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"
}
}
}
}
},
"cli": {
Expand Down
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'
};
27 changes: 27 additions & 0 deletions apps/pmp-api-e2e/src/integration/project.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import * as request from 'supertest';
import { Test } from '@nestjs/testing';
import { INestApplication } from '@nestjs/common';
import { PmpApiProjectApiModule } from '@pimp-my-pr/pmp-api/project/api';

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

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

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

it(`/GET sync`, () => {
return request(app.getHttpServer())
.get('/project/sync')
.expect(200);
});

afterAll(async () => {
await app.close();
});
});
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 @@ -25,6 +25,9 @@
},
"pmp-api-project-shell": {
"tags": ["scope:pmp-api", "type:shell"]
},
"pmp-api-e2e": {
"tags": ["type:application", "scope:pmp-api"]
}
}
}
51 changes: 51 additions & 0 deletions package-lock.json

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

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"ts-jest": "24.0.0",
"ts-node": "~7.0.0",
"tslint": "~5.11.0",
"typescript": "~3.4.5"
"typescript": "~3.4.5",
"supertest": "latest"
}
}

0 comments on commit 5d9f375

Please sign in to comment.