@vida-global/core 1.2.5 → 1.3.1

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.
Files changed (48) hide show
  1. package/.github/workflows/npm-test.yml +24 -0
  2. package/index.js +1 -1
  3. package/lib/{active_record → activeRecord}/README.md +3 -3
  4. package/lib/{active_record → activeRecord}/baseRecord.js +11 -2
  5. package/lib/{active_record → activeRecord}/db/schema.js +1 -1
  6. package/lib/http/README.md +2 -2
  7. package/lib/server/README.md +181 -20
  8. package/lib/server/apiDocsGenerator.js +55 -0
  9. package/lib/server/controllerImporter.js +62 -0
  10. package/lib/server/errors.js +28 -0
  11. package/lib/server/index.js +3 -3
  12. package/lib/server/server.js +7 -53
  13. package/lib/server/serverController.js +147 -20
  14. package/package.json +1 -1
  15. package/scripts/{active_record → activeRecord}/migrate.js +1 -1
  16. package/test/{active_record → activeRecord}/baseRecord.test.js +46 -90
  17. package/test/activeRecord/db/connection.test.js +149 -0
  18. package/test/activeRecord/db/connectionConfiguration.test.js +128 -0
  19. package/test/activeRecord/db/migrator.test.js +144 -0
  20. package/test/activeRecord/db/queryInterface.test.js +48 -0
  21. package/test/activeRecord/helpers/baseRecord.js +32 -0
  22. package/test/activeRecord/helpers/baseRecordMocks.js +59 -0
  23. package/test/activeRecord/helpers/connection.js +28 -0
  24. package/test/activeRecord/helpers/connectionConfiguration.js +32 -0
  25. package/test/activeRecord/helpers/fixtures.js +39 -0
  26. package/test/activeRecord/helpers/migrator.js +78 -0
  27. package/test/activeRecord/helpers/queryInterface.js +29 -0
  28. package/test/http/client.test.js +61 -239
  29. package/test/http/error.test.js +23 -47
  30. package/test/http/helpers/client.js +80 -0
  31. package/test/http/helpers/error.js +31 -0
  32. package/test/server/helpers/autoload/TmpWithHelpersController.js +17 -0
  33. package/test/server/helpers/serverController.js +13 -0
  34. package/test/server/serverController.test.js +319 -6
  35. package/test/active_record/db/connection.test.js +0 -221
  36. package/test/active_record/db/connectionConfiguration.test.js +0 -184
  37. package/test/active_record/db/migrator.test.js +0 -266
  38. package/test/active_record/db/queryInterface.test.js +0 -66
  39. /package/lib/{active_record → activeRecord}/db/connection.js +0 -0
  40. /package/lib/{active_record → activeRecord}/db/connectionConfiguration.js +0 -0
  41. /package/lib/{active_record → activeRecord}/db/importSchema.js +0 -0
  42. /package/lib/{active_record → activeRecord}/db/migration.js +0 -0
  43. /package/lib/{active_record → activeRecord}/db/migrationTemplate.js +0 -0
  44. /package/lib/{active_record → activeRecord}/db/migrationVersion.js +0 -0
  45. /package/lib/{active_record → activeRecord}/db/migrator.js +0 -0
  46. /package/lib/{active_record → activeRecord}/db/queryInterface.js +0 -0
  47. /package/lib/{active_record → activeRecord}/index.js +0 -0
  48. /package/lib/{active_record → activeRecord}/utils.js +0 -0
@@ -1,26 +1,6 @@
1
1
  const { HttpClient } = require('../../lib/http/client');
2
- const TestHelpers = require('@vida-global/test-helpers');
3
2
  const { logger } = require('../../lib/logger');
4
-
5
-
6
- const urlRoot = `https://${TestHelpers.Faker.Text.randomString()}.com`.toLowerCase();
7
- const apiEndpoint = `/${TestHelpers.Faker.Text.randomString()}`
8
- const apiUrl = `${urlRoot}${apiEndpoint}`;
9
- const requestReturnValue = {
10
- [TestHelpers.Faker.Text.randomString()]: Math.random()
11
- };
12
-
13
-
14
- class ClientWithUrlRoot extends HttpClient {
15
- get urlRoot() { return urlRoot; }
16
- }
17
-
18
-
19
- global.fetch = jest.fn().mockReturnValue({
20
- json: () => requestReturnValue,
21
- status: 200
22
- });
23
- logger.info = jest.fn();
3
+ const Helpers = require('./helpers/client');
24
4
 
25
5
 
26
6
  afterEach(() => {
@@ -28,244 +8,86 @@ afterEach(() => {
28
8
  });
29
9
 
30
10
 
31
- describe('HttpClient#urlRoot', () => {
32
- it ('prepends the url root when overriden', async () => {
33
- const client = new ClientWithUrlRoot();
34
- await client.post(apiEndpoint);
35
- expect(fetch).toHaveBeenCalledWith(apiUrl, expect.any(Object));
36
- });
37
- });
38
-
39
-
40
- /***************************************************************************************************
41
- * POST
42
- ***************************************************************************************************/
43
- describe('HttpClient#post', () => {
44
- const client = new HttpClient();
45
-
46
- it ('returns the result of the API request', async () => {
47
- const res = await client.post(apiUrl);
48
- expect(res).toEqual({data: requestReturnValue, status: 200});
49
- });
50
-
51
- it ('calls fetch with the provided url and default params', async () => {
52
- const expectedRequestParams = {
53
- method: 'POST',
54
- body: "{}",
55
- headers: {
56
- Accept: "application/json",
57
- "Content-Type": "application/json",
58
- }
59
- }
60
-
61
- await client.post(apiUrl);
62
- expect(fetch).toHaveBeenCalledTimes(1);
63
- expect(fetch).toHaveBeenCalledWith(apiUrl, expectedRequestParams);
64
- });
65
-
66
- it ('includes the provided body in the request', async () => {
67
- const body = {[TestHelpers.Faker.Text.randomString()]: Math.random()};
68
- await client.post(apiUrl, { body });
69
- expect(fetch).toHaveBeenCalledWith(apiUrl, expect.objectContaining({
70
- body: JSON.stringify(body)
71
- }));
72
- });
73
-
74
- it ('includes additional headers', async () => {
75
- const headers = {[TestHelpers.Faker.Text.randomString()]: Math.random()};
76
- const expectedRequestParams = {
77
- method: 'POST',
78
- body: "{}",
79
- headers: {
80
- Accept: "application/json",
81
- "Content-Type": "application/json",
82
- ...headers
83
- },
84
- }
85
-
86
- await client.post(apiUrl, { headers });
87
- expect(fetch).toHaveBeenCalledWith(apiUrl, expectedRequestParams);
88
- });
89
-
90
- it ('logs api requests', async () => {
91
- await client.post(apiUrl);
92
- expect(logger.info).toHaveBeenCalledTimes(1);
93
- expect(logger.info).toHaveBeenCalledWith(`API CALL: POST ${apiUrl}`);
94
- });
11
+ beforeEach(() => {
12
+ Helpers.mockFetchSuccess();
13
+ logger.info = jest.fn();
95
14
  });
96
15
 
97
16
 
98
- /***************************************************************************************************
99
- * PUT
100
- ***************************************************************************************************/
101
- describe('HttpClient#put', () => {
102
- const client = new HttpClient();
103
-
104
- it ('returns the result of the API request', async () => {
105
- const res = await client.put(apiUrl);
106
- expect(res).toEqual({data: requestReturnValue, status: 200});
107
- });
108
-
109
- it ('calls fetch with the provided url and default params', async () => {
110
- const expectedRequestParams = {
111
- method: 'PUT',
112
- body: "{}",
113
- headers: {
114
- Accept: "application/json",
115
- "Content-Type": "application/json",
116
- }
117
- }
118
-
119
- await client.put(apiUrl);
120
- expect(fetch).toHaveBeenCalledTimes(1);
121
- expect(fetch).toHaveBeenCalledWith(apiUrl, expectedRequestParams);
122
- });
17
+ describe('HttpClient', () => {
18
+ describe('HttpClient#urlRoot', () => {
19
+ it('prepends the url root when overridden', async () => {
20
+ const client = new Helpers.ClientWithUrlRoot();
123
21
 
124
- it ('includes the provided body in the request', async () => {
125
- const body = {[TestHelpers.Faker.Text.randomString()]: Math.random()};
126
- await client.put(apiUrl, { body });
127
- expect(fetch).toHaveBeenCalledWith(apiUrl, expect.objectContaining({
128
- body: JSON.stringify(body)
129
- }));
130
- });
131
-
132
- it ('includes additional headers', async () => {
133
- const headers = {[TestHelpers.Faker.Text.randomString()]: Math.random()};
134
- const expectedRequestParams = {
135
- method: 'PUT',
136
- body: "{}",
137
- headers: {
138
- Accept: "application/json",
139
- "Content-Type": "application/json",
140
- ...headers
141
- },
142
- }
143
-
144
- await client.put(apiUrl, { headers });
145
- expect(fetch).toHaveBeenCalledWith(apiUrl, expectedRequestParams);
146
- });
147
-
148
- it ('logs api requests', async () => {
149
- await client.put(apiUrl);
150
- expect(logger.info).toHaveBeenCalledTimes(1);
151
- expect(logger.info).toHaveBeenCalledWith(`API CALL: PUT ${apiUrl}`);
152
- });
153
- });
22
+ await client.post(Helpers.endpoint);
154
23
 
24
+ expect(fetch).toHaveBeenCalledWith(Helpers.apiUrl, expect.any(Object));
25
+ });
26
+ });
155
27
 
156
- /***************************************************************************************************
157
- * GET
158
- ***************************************************************************************************/
159
- describe('HttpClient#get', () => {
160
- const client = new HttpClient();
161
- it ('returns the result of the API request', async () => {
162
- const res = await client.get(apiUrl);
163
- expect(res).toEqual({data: requestReturnValue, status: 200});
164
- });
165
28
 
166
- it ('calls fetch with the provided url and default params', async () => {
167
- const expectedRequestParams = {
168
- method: 'GET',
169
- headers: {
170
- Accept: "application/json",
171
- "Content-Type": "application/json",
172
- }
173
- }
29
+ const httpMethods = [
30
+ ['post', 'POST', { supportsBody: true }],
31
+ ['put', 'PUT', { supportsBody: true }],
32
+ ['get', 'GET', { supportsParams: true }],
33
+ ['delete', 'DELETE', { supportsParams: true }],
34
+ ];
35
+ describe.each(httpMethods)('HttpClient#%s', (methodName, httpMethod, behavior) => {
36
+ const client = new HttpClient();
174
37
 
175
- await client.get(apiUrl);
176
- expect(fetch).toHaveBeenCalledTimes(1);
177
- expect(fetch).toHaveBeenCalledWith(apiUrl, expectedRequestParams);
178
- });
38
+ it ('returns the API result payload and status', async () => {
39
+ const result = await client[methodName](Helpers.apiUrl);
179
40
 
180
- it ('includes the provided params in the url', async () => {
181
- const param1Name = TestHelpers.Faker.Text.randomString();
182
- const param1Value = TestHelpers.Faker.Text.randomString();
183
- const param2Name = TestHelpers.Faker.Text.randomString();
184
- const param2Value = TestHelpers.Faker.Text.randomString();
185
- const requestParams = {[param1Name]: param1Value, [param2Name]: param2Value};
186
- const expectedUrl = `${apiUrl}?${param1Name}=${param1Value}&${param2Name}=${param2Value}`;
187
- await client.get(apiUrl, {requestParams });
41
+ expect(result).toEqual({ data: Helpers.responsePayload, status: 200 });
42
+ });
188
43
 
189
- expect(fetch).toHaveBeenCalledWith(expectedUrl, expect.any(Object));
190
- });
44
+ it ('calls fetch with default headers', async () => {
45
+ await client[methodName](Helpers.apiUrl);
191
46
 
192
- it ('includes additional headers', async () => {
193
- const headers = {[TestHelpers.Faker.Text.randomString()]: Math.random()};
194
- const expectedRequestParams = {
195
- method: 'GET',
196
- headers: {
197
- Accept: "application/json",
198
- "Content-Type": "application/json",
199
- ...headers
200
- },
201
- }
47
+ const expectedBody = behavior.supportsBody ? {} : undefined;
48
+ Helpers.expectRequest(httpMethod, Helpers.apiUrl, { body: expectedBody });
49
+ });
202
50
 
203
- await client.get(apiUrl, { headers });
204
- expect(fetch).toHaveBeenCalledWith(apiUrl, expectedRequestParams);
205
- });
51
+ it ('merges additional headers', async () => {
52
+ const headers = Helpers.randomPayload();
206
53
 
207
- it ('logs api requests', async () => {
208
- await client.get(apiUrl);
209
- expect(logger.info).toHaveBeenCalledTimes(1);
210
- expect(logger.info).toHaveBeenCalledWith(`API CALL: GET ${apiUrl}`);
211
- });
212
- });
54
+ await client[methodName](Helpers.apiUrl, { headers });
213
55
 
56
+ const expectedBody = behavior.supportsBody ? {} : undefined;
57
+ Helpers.expectRequest(httpMethod, Helpers.apiUrl, { headers, body: expectedBody });
58
+ });
214
59
 
215
- /***************************************************************************************************
216
- * DELETE
217
- ***************************************************************************************************/
218
- describe('HttpClient#delete', () => {
219
- const client = new HttpClient();
220
- it ('returns the result of the API request', async () => {
221
- const res = await client.delete(apiUrl);
222
- expect(res).toEqual({data: requestReturnValue, status: 200});
223
- });
60
+ it ('logs API requests', async () => {
61
+ await client[methodName](Helpers.apiUrl);
224
62
 
225
- it ('calls fetch with the provided url and default params', async () => {
226
- const expectedRequestParams = {
227
- method: 'DELETE',
228
- headers: {
229
- Accept: "application/json",
230
- "Content-Type": "application/json",
231
- }
232
- }
63
+ expect(logger.info).toHaveBeenCalledTimes(1);
64
+ expect(logger.info).toHaveBeenCalledWith(`API CALL: ${httpMethod} ${Helpers.apiUrl}`);
65
+ });
233
66
 
234
- await client.delete(apiUrl);
235
- expect(fetch).toHaveBeenCalledTimes(1);
236
- expect(fetch).toHaveBeenCalledWith(apiUrl, expectedRequestParams);
237
- });
67
+ if (behavior.supportsBody) {
68
+ it('serializes and sends request body', async () => {
69
+ const body = Helpers.randomPayload();
238
70
 
239
- it ('includes the provided params in the url', async () => {
240
- const param1Name = TestHelpers.Faker.Text.randomString();
241
- const param1Value = TestHelpers.Faker.Text.randomString();
242
- const param2Name = TestHelpers.Faker.Text.randomString();
243
- const param2Value = TestHelpers.Faker.Text.randomString();
244
- const requestParams = {[param1Name]: param1Value, [param2Name]: param2Value};
245
- const expectedUrl = `${apiUrl}?${param1Name}=${param1Value}&${param2Name}=${param2Value}`;
246
- await client.delete(apiUrl, {requestParams });
71
+ await client[methodName](Helpers.apiUrl, { body });
247
72
 
248
- expect(fetch).toHaveBeenCalledWith(expectedUrl, expect.any(Object));
249
- });
73
+ expect(fetch).toHaveBeenCalledWith(
74
+ Helpers.apiUrl,
75
+ expect.objectContaining({ body: JSON.stringify(body) }),
76
+ );
77
+ });
78
+ }
250
79
 
251
- it ('includes additional headers', async () => {
252
- const headers = {[TestHelpers.Faker.Text.randomString()]: Math.random()};
253
- const expectedRequestParams = {
254
- method: 'DELETE',
255
- headers: {
256
- Accept: "application/json",
257
- "Content-Type": "application/json",
258
- ...headers
259
- },
260
- }
80
+ if (behavior.supportsParams) {
81
+ it('adds request params to url', async () => {
82
+ const requestParams = {
83
+ first: 'one',
84
+ second: 'two',
85
+ };
261
86
 
262
- await client.delete(apiUrl, { headers });
263
- expect(fetch).toHaveBeenCalledWith(apiUrl, expectedRequestParams);
264
- });
87
+ await client[methodName](Helpers.apiUrl, { requestParams });
265
88
 
266
- it ('logs api requests', async () => {
267
- await client.delete(apiUrl);
268
- expect(logger.info).toHaveBeenCalledTimes(1);
269
- expect(logger.info).toHaveBeenCalledWith(`API CALL: DELETE ${apiUrl}`);
270
- });
89
+ expect(fetch).toHaveBeenCalledWith(`${Helpers.apiUrl}?first=one&second=two`, expect.any(Object));
90
+ });
91
+ }
92
+ });
271
93
  });
@@ -1,71 +1,47 @@
1
- const { HttpError } = require('../../lib/http/error');
2
- const TestHelpers = require('@vida-global/test-helpers');
1
+ const { HttpError } = require('../../lib/http/error');
2
+ const TestHelpers = require('@vida-global/test-helpers');
3
+ const { buildRequestPayload, buildResponse } = require('./helpers/error');
3
4
 
4
- const key1 = TestHelpers.Faker.Text.randomString()
5
- const key2 = TestHelpers.Faker.Text.randomString()
6
- const key3 = TestHelpers.Faker.Text.randomString()
7
- const key4 = TestHelpers.Faker.Text.randomString()
8
- const key5 = TestHelpers.Faker.Text.randomString()
9
- const val1 = TestHelpers.Faker.Text.randomString()
10
- const val2 = TestHelpers.Faker.Text.randomString()
11
- const val3 = TestHelpers.Faker.Text.randomString()
12
- const val4 = TestHelpers.Faker.Text.randomString()
13
- const val5 = TestHelpers.Faker.Text.randomString()
14
5
 
15
- const response = {
16
- headers: {
17
- [key1]: val1,
18
- [key2]: val2,
19
- },
20
- status: Math.random(),
21
- statusText: TestHelpers.Faker.Text.randomString(),
22
- url: TestHelpers.Faker.Text.randomString(),
23
- };
24
- const requestPayload = {
25
- [key3]: val3,
26
- [key4]: {[key5]: val5}
27
- };
28
- const error = new HttpError(response, requestPayload);
6
+ let response;
7
+ let requestPayload;
8
+ let error;
9
+
10
+ beforeEach(() => {
11
+ response = buildResponse();
12
+ requestPayload = buildRequestPayload();
13
+ error = new HttpError(response, requestPayload);
14
+ });
29
15
 
30
16
 
31
17
  describe('HttpError', () => {
32
- it ('returns the status code in the message', () => {
18
+ it ('sets the status code in the message', () => {
33
19
  expect(error.message).toEqual(`HTTP Error: ${response.status}`);
34
20
  });
35
21
 
36
- it ('returns the response status code as the status', () => {
22
+ it ('exposes core response metadata', () => {
37
23
  expect(error.status).toEqual(response.status);
38
- });
39
-
40
- it ('passes through the status text', () => {
41
24
  expect(error.statusText).toEqual(response.statusText);
42
- });
43
-
44
- it ('passes through the url', () => {
45
25
  expect(error.url).toEqual(response.url);
46
26
  });
47
27
 
48
- it ('passes through a copy of the response headers', () => {
28
+ it ('stores copies of headers and request payload', () => {
49
29
  expect(error.responseHeaders).toEqual(response.headers);
50
30
  expect(error.responseHeaders).not.toBe(response.headers);
51
- });
52
-
53
- it ('passes through a copy of the request payload', () => {
54
31
  expect(error.requestPayload).toEqual(requestPayload);
55
32
  expect(error.requestPayload).not.toBe(requestPayload);
56
33
  });
57
34
 
58
- it ('converts the response body to JSON if possible', async () => {
59
- response.text = () => `{"${key1}": "${val1}", "${key2}": {"${key3}": "${val3}"}}`;
60
- const data = await error.data();
61
- const expected = {[key1]: val1, [key2]: {[key3]: val3}};
62
- expect(data).toEqual(expected);
35
+ it ('parses json text bodies', async () => {
36
+ response.text = () => '{"ok":true,"nested":{"count":1}}';
37
+
38
+ await expect(error.data()).resolves.toEqual({ ok: true, nested: { count: 1 } });
63
39
  });
64
40
 
65
- it ('returns text when the body is not JSON', async () => {
41
+ it ('falls back to raw text when parsing fails', async () => {
66
42
  const text = TestHelpers.Faker.Text.randomString();
67
- response.text = () => text;
68
- const data = await error.data();
69
- expect(data).toEqual(text);
43
+ response.text = () => text;
44
+
45
+ await expect(error.data()).resolves.toEqual(text);
70
46
  });
71
47
  });
@@ -0,0 +1,80 @@
1
+ const { HttpClient } = require('../../../lib/http/client');
2
+ const TestHelpers = require('@vida-global/test-helpers');
3
+
4
+
5
+ /***************************************************************************************************
6
+ * VARIABLES / VARIABLE GENERATION
7
+ ***************************************************************************************************/
8
+ const randomPayload = () => {
9
+ return {
10
+ [TestHelpers.Faker.Text.randomString()]: Math.random(),
11
+ };
12
+ }
13
+
14
+
15
+ const baseUrl = `https://${TestHelpers.Faker.Text.randomString()}.com`.toLowerCase();
16
+ const endpoint = `/${TestHelpers.Faker.Text.randomString()}`;
17
+ const apiUrl = `${baseUrl}${endpoint}`;
18
+ const responsePayload = randomPayload();
19
+
20
+
21
+ class ClientWithUrlRoot extends HttpClient {
22
+ get urlRoot() {
23
+ return baseUrl;
24
+ }
25
+ }
26
+
27
+
28
+ /***************************************************************************************************
29
+ * MOCKS
30
+ ***************************************************************************************************/
31
+ const mockFetchSuccess = () => {
32
+ global.fetch = jest.fn().mockResolvedValue({
33
+ json: jest.fn().mockResolvedValue(responsePayload),
34
+ status: 200,
35
+ });
36
+ }
37
+
38
+
39
+ /***************************************************************************************************
40
+ * ASSERTIONS
41
+ ***************************************************************************************************/
42
+ function expectRequest(method, expectedUrl, options = {}) {
43
+ const expectedRequest = buildExpectedRequest({
44
+ method,
45
+ headers: options.headers,
46
+ body: options.body,
47
+ });
48
+
49
+ expect(fetch).toHaveBeenCalledTimes(1);
50
+ expect(fetch).toHaveBeenCalledWith(expectedUrl, expectedRequest);
51
+ }
52
+
53
+
54
+ function buildExpectedRequest({ method, headers, body }) {
55
+ const request = {
56
+ method,
57
+ headers: {
58
+ Accept: 'application/json',
59
+ 'Content-Type': 'application/json',
60
+ ...(headers || {}),
61
+ },
62
+ };
63
+
64
+ if (body !== undefined) {
65
+ request.body = JSON.stringify(body);
66
+ }
67
+
68
+ return request;
69
+ }
70
+
71
+
72
+ module.exports = {
73
+ apiUrl,
74
+ ClientWithUrlRoot,
75
+ endpoint,
76
+ expectRequest,
77
+ mockFetchSuccess,
78
+ randomPayload,
79
+ responsePayload,
80
+ };
@@ -0,0 +1,31 @@
1
+ const TestHelpers = require('@vida-global/test-helpers');
2
+
3
+
4
+ function buildResponse(overrides = {}) {
5
+ return {
6
+ headers: {
7
+ requestId: TestHelpers.Faker.Text.randomString(),
8
+ traceId: TestHelpers.Faker.Text.randomString(),
9
+ },
10
+ status: Math.floor(Math.random() * 500) + 100,
11
+ statusText: TestHelpers.Faker.Text.randomString(),
12
+ url: TestHelpers.Faker.Text.randomString(),
13
+ ...overrides,
14
+ };
15
+ }
16
+
17
+
18
+ function buildRequestPayload() {
19
+ return {
20
+ foo: TestHelpers.Faker.Text.randomString(),
21
+ nested: {
22
+ bar: TestHelpers.Faker.Text.randomString(),
23
+ },
24
+ };
25
+ }
26
+
27
+
28
+ module.exports = {
29
+ buildRequestPayload,
30
+ buildResponse,
31
+ }
@@ -0,0 +1,17 @@
1
+ const InstanceMethods = {
2
+ anInstanceMethod: jest.fn()
3
+ }
4
+
5
+
6
+ const Accessors = {
7
+ aProperty: {
8
+ get: jest.fn(),
9
+ set: jest.fn()
10
+ }
11
+ }
12
+
13
+
14
+ module.exports = {
15
+ Accessors,
16
+ InstanceMethods
17
+ }
@@ -0,0 +1,13 @@
1
+ const TestHelpers = require('@vida-global/test-helpers');
2
+
3
+
4
+ const randomPayload = () => {
5
+ return {
6
+ [TestHelpers.Faker.Text.randomString()]: Math.random(),
7
+ };
8
+ }
9
+
10
+
11
+ module.exports = {
12
+ randomPayload
13
+ }