express-generator-typescript 2.5.7 → 2.5.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -27,7 +27,7 @@
27
27
  "jet-logger": "^2.0.1",
28
28
  "jet-paths": "^1.1.0",
29
29
  "jet-schema": "^1.4.2",
30
- "jet-validators": "^1.0.6",
30
+ "jet-validators": "^1.0.8",
31
31
  "jsonfile": "^6.1.0",
32
32
  "module-alias": "^2.2.2",
33
33
  "morgan": "^1.10.0"
@@ -1,7 +1,7 @@
1
1
  import supertest, { Test } from 'supertest';
2
2
  import TestAgent from 'supertest/lib/agent';
3
3
  import insertUrlParams from 'inserturlparams';
4
- import { safeJsonParse } from 'jet-validators/utils';
4
+ import { parseJson } from 'jet-validators/utils';
5
5
  import logger from 'jet-logger';
6
6
 
7
7
  import app from '@src/server';
@@ -35,11 +35,7 @@ const wrapCb = (cb: TApiCb) => (err: Error, res: TRes) => {
35
35
  if (!!err) {
36
36
  logger.err(err);
37
37
  }
38
- if (!!res.body.user) {
39
- createdKeyToDate(res.body.user);
40
- } else if (!!res.body.users) {
41
- res.body.users?.map(user => createdKeyToDate(user));
42
- }
38
+ createdKeyToDate(res.body);
43
39
  return cb(res);
44
40
  };
45
41
 
@@ -111,7 +107,7 @@ describe('UserRouter', () => {
111
107
  // Call api
112
108
  callApi(null, res => {
113
109
  expect(res.status).toBe(HttpStatusCodes.BAD_REQUEST);
114
- const errorObj = safeJsonParse<IValidationErrFormat>(res.body.error);
110
+ const errorObj = parseJson<IValidationErrFormat>(res.body.error);
115
111
  expect(errorObj.error).toBe(ValidationErr.MSG);
116
112
  expect(errorObj.parameter).toBe('user');
117
113
  done();
@@ -148,7 +144,7 @@ describe('UserRouter', () => {
148
144
  done => {
149
145
  callApi(null, res => {
150
146
  expect(res.status).toBe(HttpStatusCodes.BAD_REQUEST);
151
- const errorObj = safeJsonParse<IValidationErrFormat>(res.body.error);
147
+ const errorObj = parseJson<IValidationErrFormat>(res.body.error);
152
148
  expect(errorObj.error).toBe(ValidationErr.MSG);
153
149
  expect(errorObj.parameter).toBe('user');
154
150
  done();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "express-generator-typescript",
3
- "version": "2.5.7",
3
+ "version": "2.5.8",
4
4
  "description": "Generate new Express applications similar to express-generate which but sets it up to use TypeScript instead",
5
5
  "scripts": {
6
6
  "express-generator-typescript": "node bin/cli.js",