Skip to content

Commit

Permalink
691st Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Shyam-Chen committed Jul 26, 2021
1 parent cfcd7e9 commit dc2b409
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
7 changes: 7 additions & 0 deletions e2e/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
testEnvironment: 'node',
testURL: 'http://localhost/',
transform: {
'^.+\\.js$': 'babel-jest',
},
};
3 changes: 3 additions & 0 deletions e2e/setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
jest.setTimeout(100 * 1000);

global.API_URL = 'http://localhost:3000';
1 change: 1 addition & 0 deletions e2e/src/hello-world.meas.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import autocannon from 'autocannon';
6 changes: 2 additions & 4 deletions e2e/src/hello-world.spec.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
import request from 'supertest';

import app from '~/app';

describe('Hello World', () => {
it('should get a `Hello, World!`', async () => {
const response = await request(app).post('/hello-world');
const response = await request(global.API_URL).post('/hello-world');

expect(response.statusCode).toEqual(200);
expect(response.body).toEqual({ data: 'Hello, World!' });
});

it('should get a `Hello, Express!`', async () => {
const response = await request(app)
const response = await request(global.API_URL)
.post('/hello-world')
.send({ data: 'Express' });

Expand Down
3 changes: 2 additions & 1 deletion mock/requests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "1.0.0",
"private": true,
"scripts": {
"serve": "webpack -w"
"serve": "rimraf dist && webpack -w"
},
"dependencies": {
"@koa/cors": "^3.1.0",
Expand All @@ -17,6 +17,7 @@
"@babel/preset-env": "^7.3.4",
"babel-loader": "^8.0.5",
"process-envify": "^0.1.3",
"rimraf": "^3.0.2",
"start-server-webpack-plugin": "^2.2.5",
"webpack": "^4.29.5",
"webpack-cli": "^3.2.3",
Expand Down

0 comments on commit dc2b409

Please sign in to comment.