Skip to content

Commit ab48800

Browse files
chore: add fix to script eslint
1 parent a6747f5 commit ab48800

File tree

7 files changed

+11
-32
lines changed

7 files changed

+11
-32
lines changed

mock/api/posts.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ module.exports = {
44
{
55
userId: 1,
66
id: 1,
7-
title:
8-
'sunt aut facere repellat provident occaecati excepturi optio reprehenderit',
7+
title: 'sunt aut facere repellat provident occaecati excepturi optio reprehenderit',
98
body:
109
'quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto',
1110
},

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"compile": "tsc",
1212
"test": "cross-env NODE_ENV=test jest --runInBand",
1313
"lint": "yarn lint:base ./src ./mock ./test",
14-
"lint:base": "eslint --ext .js,.json,.ts"
14+
"lint:base": "eslint --fix --ext .js,.json,.ts"
1515
},
1616
"repository": {
1717
"type": "git",

src/app.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,7 @@ if (serverConfig['enabledLogs'] == 'false') {
2222
}
2323

2424
const corsOptions = {
25-
origin:
26-
serverConfig['corsEnabled'] == 'true'
27-
? serverConfig['origins'].split(',')
28-
: '*',
25+
origin: serverConfig['corsEnabled'] == 'true' ? serverConfig['origins'].split(',') : '*',
2926
methods: serverConfig['methodsAllowed'],
3027
credentials: serverConfig['corsCredentials'],
3128
allowedHeaders: serverConfig['headersAllowed'],
@@ -64,10 +61,7 @@ app.use((req: Request, res: Response, next: NextFunction) => {
6461
const allowedOrigins = serverConfig['origins'].split(',');
6562
const origin = req['headers']['origin'] || '*';
6663

67-
if (
68-
serverConfig['corsEnabled'] == 'true' &&
69-
allowedOrigins.includes(origin)
70-
) {
64+
if (serverConfig['corsEnabled'] == 'true' && allowedOrigins.includes(origin)) {
7165
res.header('Access-Control-Allow-Origin', origin);
7266
res.header('Access-Control-Allow-Methods', serverConfig['methodsAllowed']);
7367
res.header('Access-Control-Allow-Headers', serverConfig['headersAllowed']);

src/utils/converters.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
export const toStringify = (
2-
data: any,
3-
replace: any = null,
4-
space: number = 2,
5-
): string => {
1+
export const toStringify = (data: any, replace: any = null, space: number = 2): string => {
62
return JSON.stringify(data, replace, space);
73
};

src/utils/http-client.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
import axios, {
2-
AxiosPromise,
3-
AxiosRequestConfig,
4-
AxiosResponse,
5-
Method,
6-
} from 'axios';
1+
import axios, { AxiosPromise, AxiosRequestConfig, AxiosResponse, Method } from 'axios';
72
import https from 'https';
83
import { toStringify } from './converters';
94
import signale from './signale';

test/health.spec.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
11
import request from 'supertest';
2-
const config = require('config');
32
import app from '../src/app';
43

4+
const config = require('config');
5+
56
const serverConfig = config['server'];
67

78
describe('Endpoint Health', () => {
89
it('Should be return status 200', async () => {
9-
const result = await request(app)
10-
.get(`${serverConfig['context']}/health`)
11-
.send();
10+
const result = await request(app).get(`${serverConfig['context']}/health`).send();
1211
expect(result.status).toBe(200);
1312
});
1413

1514
it('Should be return status up', async () => {
16-
const result = await request(app)
17-
.get(`${serverConfig['context']}/health`)
18-
.send();
15+
const result = await request(app).get(`${serverConfig['context']}/health`).send();
1916
expect(result.body.status).toEqual('UP');
2017
});
2118
});

test/home.spec.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ describe('Endpoint root', () => {
1111

1212
it('Should be return message and version', async () => {
1313
const result = await request(app).get(`/`).send();
14-
expect(result.text).toEqual(
15-
`Welcome to server express - v${pjson['version']}`,
16-
);
14+
expect(result.text).toEqual(`Welcome to server express - v${pjson['version']}`);
1715
});
1816
});

0 commit comments

Comments
 (0)