@seidor-cloud-produtos/orbit-backend-lib 0.0.39 → 0.0.40

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.
@@ -4,6 +4,11 @@ exports.ExpressMappingModel = void 0;
4
4
  const mapping_model_1 = require('../../../infra/http/api-gateway/mapping-model');
5
5
  class ExpressMappingModel extends mapping_model_1.MappingModel {
6
6
  getBody() {
7
+ if (
8
+ this.controller.request.body &&
9
+ this.controller.request.body['body-json']
10
+ )
11
+ return this.controller.request.body['body-json'];
7
12
  return this.controller.request.body;
8
13
  }
9
14
  getHeaders() {
@@ -69,5 +69,30 @@ const mockAuthMatcher = {
69
69
  );
70
70
  },
71
71
  );
72
+ (0, vitest_1.it)('should authorize if authorizations is null', async () => {
73
+ mockAuthMatcher.isMatch.mockReturnValue(false);
74
+ await authValidator.setup();
75
+ authValidator['requestData'].authorizations = null;
76
+ const result = await authValidator.validate();
77
+ (0, vitest_1.expect)(result).toBe('Authorized');
78
+ (0, vitest_1.expect)(mockAuthMatcher.isMatch).toHaveBeenCalledWith(
79
+ query,
80
+ ['auth1', 'auth2'],
81
+ );
82
+ });
83
+ (0, vitest_1.it)(
84
+ 'should authorize if authorizations is undefined',
85
+ async () => {
86
+ mockAuthMatcher.isMatch.mockReturnValue(false);
87
+ await authValidator.setup();
88
+ authValidator['requestData'].authorizations = undefined;
89
+ const result = await authValidator.validate();
90
+ (0, vitest_1.expect)(result).toBe('Authorized');
91
+ (0, vitest_1.expect)(mockAuthMatcher.isMatch).toHaveBeenCalledWith(
92
+ query,
93
+ ['auth1', 'auth2'],
94
+ );
95
+ },
96
+ );
72
97
  });
73
98
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seidor-cloud-produtos/orbit-backend-lib",
3
- "version": "0.0.39",
3
+ "version": "0.0.40",
4
4
  "description": "Internal lib for backend components",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",