@tsed/platform-test-sdk 7.12.0

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 (231) hide show
  1. package/lib/cjs/components/PlatformTestSdk.js +31 -0
  2. package/lib/cjs/components/PlatformTestSdk.js.map +1 -0
  3. package/lib/cjs/data/swagger.json +32 -0
  4. package/lib/cjs/errors/CustomBadRequest.js +18 -0
  5. package/lib/cjs/errors/CustomBadRequest.js.map +1 -0
  6. package/lib/cjs/errors/CustomInternalError.js +18 -0
  7. package/lib/cjs/errors/CustomInternalError.js.map +1 -0
  8. package/lib/cjs/index.js +42 -0
  9. package/lib/cjs/index.js.map +1 -0
  10. package/lib/cjs/interfaces/PlatformTestingSdkOpts.js +3 -0
  11. package/lib/cjs/interfaces/PlatformTestingSdkOpts.js.map +1 -0
  12. package/lib/cjs/interfaces/index.js +8 -0
  13. package/lib/cjs/interfaces/index.js.map +1 -0
  14. package/lib/cjs/modules/feature/FeatureModule.js +17 -0
  15. package/lib/cjs/modules/feature/FeatureModule.js.map +1 -0
  16. package/lib/cjs/modules/feature/controllers/FeatureController.js +23 -0
  17. package/lib/cjs/modules/feature/controllers/FeatureController.js.map +1 -0
  18. package/lib/cjs/package.json +3 -0
  19. package/lib/cjs/tests/exports.js +66 -0
  20. package/lib/cjs/tests/exports.js.map +1 -0
  21. package/lib/cjs/tests/testAcceptMime.js +103 -0
  22. package/lib/cjs/tests/testAcceptMime.js.map +1 -0
  23. package/lib/cjs/tests/testAuth.js +343 -0
  24. package/lib/cjs/tests/testAuth.js.map +1 -0
  25. package/lib/cjs/tests/testBodyParams.js +526 -0
  26. package/lib/cjs/tests/testBodyParams.js.map +1 -0
  27. package/lib/cjs/tests/testCache.js +292 -0
  28. package/lib/cjs/tests/testCache.js.map +1 -0
  29. package/lib/cjs/tests/testChildrenControllers.js +64 -0
  30. package/lib/cjs/tests/testChildrenControllers.js.map +1 -0
  31. package/lib/cjs/tests/testCookies.js +45 -0
  32. package/lib/cjs/tests/testCookies.js.map +1 -0
  33. package/lib/cjs/tests/testCtrlInheritance.js +161 -0
  34. package/lib/cjs/tests/testCtrlInheritance.js.map +1 -0
  35. package/lib/cjs/tests/testCustom404.js +32 -0
  36. package/lib/cjs/tests/testCustom404.js.map +1 -0
  37. package/lib/cjs/tests/testErrors.js +252 -0
  38. package/lib/cjs/tests/testErrors.js.map +1 -0
  39. package/lib/cjs/tests/testHandlers.js +110 -0
  40. package/lib/cjs/tests/testHandlers.js.map +1 -0
  41. package/lib/cjs/tests/testHeaderParams.js +166 -0
  42. package/lib/cjs/tests/testHeaderParams.js.map +1 -0
  43. package/lib/cjs/tests/testHeaders.js +101 -0
  44. package/lib/cjs/tests/testHeaders.js.map +1 -0
  45. package/lib/cjs/tests/testInheritanceController.js +173 -0
  46. package/lib/cjs/tests/testInheritanceController.js.map +1 -0
  47. package/lib/cjs/tests/testLocals.js +63 -0
  48. package/lib/cjs/tests/testLocals.js.map +1 -0
  49. package/lib/cjs/tests/testLocation.js +42 -0
  50. package/lib/cjs/tests/testLocation.js.map +1 -0
  51. package/lib/cjs/tests/testMiddlewares.js +210 -0
  52. package/lib/cjs/tests/testMiddlewares.js.map +1 -0
  53. package/lib/cjs/tests/testModule.js +49 -0
  54. package/lib/cjs/tests/testModule.js.map +1 -0
  55. package/lib/cjs/tests/testMulter.js +162 -0
  56. package/lib/cjs/tests/testMulter.js.map +1 -0
  57. package/lib/cjs/tests/testPathParams.js +142 -0
  58. package/lib/cjs/tests/testPathParams.js.map +1 -0
  59. package/lib/cjs/tests/testQueryParams.js +354 -0
  60. package/lib/cjs/tests/testQueryParams.js.map +1 -0
  61. package/lib/cjs/tests/testRedirect.js +143 -0
  62. package/lib/cjs/tests/testRedirect.js.map +1 -0
  63. package/lib/cjs/tests/testResponse.js +622 -0
  64. package/lib/cjs/tests/testResponse.js.map +1 -0
  65. package/lib/cjs/tests/testResponseFilter.js +107 -0
  66. package/lib/cjs/tests/testResponseFilter.js.map +1 -0
  67. package/lib/cjs/tests/testRouting.js +75 -0
  68. package/lib/cjs/tests/testRouting.js.map +1 -0
  69. package/lib/cjs/tests/testScopeRequest.js +116 -0
  70. package/lib/cjs/tests/testScopeRequest.js.map +1 -0
  71. package/lib/cjs/tests/testSession.js +128 -0
  72. package/lib/cjs/tests/testSession.js.map +1 -0
  73. package/lib/cjs/tests/testStatics.js +58 -0
  74. package/lib/cjs/tests/testStatics.js.map +1 -0
  75. package/lib/cjs/tests/testView.js +83 -0
  76. package/lib/cjs/tests/testView.js.map +1 -0
  77. package/lib/esm/components/PlatformTestSdk.js +27 -0
  78. package/lib/esm/components/PlatformTestSdk.js.map +1 -0
  79. package/lib/esm/data/swagger.json +32 -0
  80. package/lib/esm/errors/CustomBadRequest.js +14 -0
  81. package/lib/esm/errors/CustomBadRequest.js.map +1 -0
  82. package/lib/esm/errors/CustomInternalError.js +14 -0
  83. package/lib/esm/errors/CustomInternalError.js.map +1 -0
  84. package/lib/esm/index.js +39 -0
  85. package/lib/esm/index.js.map +1 -0
  86. package/lib/esm/interfaces/PlatformTestingSdkOpts.js +2 -0
  87. package/lib/esm/interfaces/PlatformTestingSdkOpts.js.map +1 -0
  88. package/lib/esm/interfaces/index.js +5 -0
  89. package/lib/esm/interfaces/index.js.map +1 -0
  90. package/lib/esm/modules/feature/FeatureModule.js +14 -0
  91. package/lib/esm/modules/feature/FeatureModule.js.map +1 -0
  92. package/lib/esm/modules/feature/controllers/FeatureController.js +20 -0
  93. package/lib/esm/modules/feature/controllers/FeatureController.js.map +1 -0
  94. package/lib/esm/package.json +3 -0
  95. package/lib/esm/tests/exports.js +63 -0
  96. package/lib/esm/tests/exports.js.map +1 -0
  97. package/lib/esm/tests/testAcceptMime.js +99 -0
  98. package/lib/esm/tests/testAcceptMime.js.map +1 -0
  99. package/lib/esm/tests/testAuth.js +338 -0
  100. package/lib/esm/tests/testAuth.js.map +1 -0
  101. package/lib/esm/tests/testBodyParams.js +522 -0
  102. package/lib/esm/tests/testBodyParams.js.map +1 -0
  103. package/lib/esm/tests/testCache.js +288 -0
  104. package/lib/esm/tests/testCache.js.map +1 -0
  105. package/lib/esm/tests/testChildrenControllers.js +60 -0
  106. package/lib/esm/tests/testChildrenControllers.js.map +1 -0
  107. package/lib/esm/tests/testCookies.js +41 -0
  108. package/lib/esm/tests/testCookies.js.map +1 -0
  109. package/lib/esm/tests/testCtrlInheritance.js +156 -0
  110. package/lib/esm/tests/testCtrlInheritance.js.map +1 -0
  111. package/lib/esm/tests/testCustom404.js +27 -0
  112. package/lib/esm/tests/testCustom404.js.map +1 -0
  113. package/lib/esm/tests/testErrors.js +248 -0
  114. package/lib/esm/tests/testErrors.js.map +1 -0
  115. package/lib/esm/tests/testHandlers.js +105 -0
  116. package/lib/esm/tests/testHandlers.js.map +1 -0
  117. package/lib/esm/tests/testHeaderParams.js +162 -0
  118. package/lib/esm/tests/testHeaderParams.js.map +1 -0
  119. package/lib/esm/tests/testHeaders.js +97 -0
  120. package/lib/esm/tests/testHeaders.js.map +1 -0
  121. package/lib/esm/tests/testInheritanceController.js +167 -0
  122. package/lib/esm/tests/testInheritanceController.js.map +1 -0
  123. package/lib/esm/tests/testLocals.js +59 -0
  124. package/lib/esm/tests/testLocals.js.map +1 -0
  125. package/lib/esm/tests/testLocation.js +38 -0
  126. package/lib/esm/tests/testLocation.js.map +1 -0
  127. package/lib/esm/tests/testMiddlewares.js +206 -0
  128. package/lib/esm/tests/testMiddlewares.js.map +1 -0
  129. package/lib/esm/tests/testModule.js +45 -0
  130. package/lib/esm/tests/testModule.js.map +1 -0
  131. package/lib/esm/tests/testMulter.js +156 -0
  132. package/lib/esm/tests/testMulter.js.map +1 -0
  133. package/lib/esm/tests/testPathParams.js +138 -0
  134. package/lib/esm/tests/testPathParams.js.map +1 -0
  135. package/lib/esm/tests/testQueryParams.js +349 -0
  136. package/lib/esm/tests/testQueryParams.js.map +1 -0
  137. package/lib/esm/tests/testRedirect.js +139 -0
  138. package/lib/esm/tests/testRedirect.js.map +1 -0
  139. package/lib/esm/tests/testResponse.js +615 -0
  140. package/lib/esm/tests/testResponse.js.map +1 -0
  141. package/lib/esm/tests/testResponseFilter.js +103 -0
  142. package/lib/esm/tests/testResponseFilter.js.map +1 -0
  143. package/lib/esm/tests/testRouting.js +71 -0
  144. package/lib/esm/tests/testRouting.js.map +1 -0
  145. package/lib/esm/tests/testScopeRequest.js +112 -0
  146. package/lib/esm/tests/testScopeRequest.js.map +1 -0
  147. package/lib/esm/tests/testSession.js +122 -0
  148. package/lib/esm/tests/testSession.js.map +1 -0
  149. package/lib/esm/tests/testStatics.js +54 -0
  150. package/lib/esm/tests/testStatics.js.map +1 -0
  151. package/lib/esm/tests/testView.js +79 -0
  152. package/lib/esm/tests/testView.js.map +1 -0
  153. package/lib/types/components/PlatformTestSdk.d.ts +9 -0
  154. package/lib/types/errors/CustomBadRequest.d.ts +8 -0
  155. package/lib/types/errors/CustomInternalError.d.ts +8 -0
  156. package/lib/types/index.d.ts +38 -0
  157. package/lib/types/interfaces/PlatformTestingSdkOpts.d.ts +8 -0
  158. package/lib/types/interfaces/index.d.ts +4 -0
  159. package/lib/types/modules/feature/FeatureModule.d.ts +2 -0
  160. package/lib/types/modules/feature/controllers/FeatureController.d.ts +3 -0
  161. package/lib/types/tests/exports.d.ts +2 -0
  162. package/lib/types/tests/testAcceptMime.d.ts +2 -0
  163. package/lib/types/tests/testAuth.d.ts +8 -0
  164. package/lib/types/tests/testBodyParams.d.ts +3 -0
  165. package/lib/types/tests/testCache.d.ts +2 -0
  166. package/lib/types/tests/testChildrenControllers.d.ts +2 -0
  167. package/lib/types/tests/testCookies.d.ts +11 -0
  168. package/lib/types/tests/testCtrlInheritance.d.ts +18 -0
  169. package/lib/types/tests/testCustom404.d.ts +2 -0
  170. package/lib/types/tests/testErrors.d.ts +19 -0
  171. package/lib/types/tests/testHandlers.d.ts +12 -0
  172. package/lib/types/tests/testHeaderParams.d.ts +16 -0
  173. package/lib/types/tests/testHeaders.d.ts +8 -0
  174. package/lib/types/tests/testInheritanceController.d.ts +28 -0
  175. package/lib/types/tests/testLocals.d.ts +2 -0
  176. package/lib/types/tests/testLocation.d.ts +2 -0
  177. package/lib/types/tests/testMiddlewares.d.ts +8 -0
  178. package/lib/types/tests/testModule.d.ts +2 -0
  179. package/lib/types/tests/testMulter.d.ts +21 -0
  180. package/lib/types/tests/testPathParams.d.ts +2 -0
  181. package/lib/types/tests/testQueryParams.d.ts +6 -0
  182. package/lib/types/tests/testRedirect.d.ts +2 -0
  183. package/lib/types/tests/testResponse.d.ts +16 -0
  184. package/lib/types/tests/testResponseFilter.d.ts +2 -0
  185. package/lib/types/tests/testRouting.d.ts +7 -0
  186. package/lib/types/tests/testScopeRequest.d.ts +12 -0
  187. package/lib/types/tests/testSession.d.ts +16 -0
  188. package/lib/types/tests/testStatics.d.ts +2 -0
  189. package/lib/types/tests/testView.d.ts +2 -0
  190. package/package.json +44 -0
  191. package/src/components/PlatformTestSdk.ts +29 -0
  192. package/src/data/file.txt +1 -0
  193. package/src/data/response.data.json +3 -0
  194. package/src/data/swagger.json +32 -0
  195. package/src/errors/CustomBadRequest.ts +16 -0
  196. package/src/errors/CustomInternalError.ts +16 -0
  197. package/src/index.ts +39 -0
  198. package/src/interfaces/PlatformTestingSdkOpts.ts +10 -0
  199. package/src/interfaces/index.ts +5 -0
  200. package/src/modules/feature/FeatureModule.ts +9 -0
  201. package/src/modules/feature/controllers/FeatureController.ts +11 -0
  202. package/src/tests/exports.ts +69 -0
  203. package/src/tests/testAcceptMime.ts +95 -0
  204. package/src/tests/testAuth.ts +339 -0
  205. package/src/tests/testBodyParams.ts +455 -0
  206. package/src/tests/testCache.ts +270 -0
  207. package/src/tests/testChildrenControllers.ts +55 -0
  208. package/src/tests/testCookies.ts +36 -0
  209. package/src/tests/testCtrlInheritance.ts +140 -0
  210. package/src/tests/testCustom404.ts +33 -0
  211. package/src/tests/testErrors.ts +223 -0
  212. package/src/tests/testHandlers.ts +92 -0
  213. package/src/tests/testHeaderParams.ts +149 -0
  214. package/src/tests/testHeaders.ts +91 -0
  215. package/src/tests/testInheritanceController.ts +156 -0
  216. package/src/tests/testLocals.ts +46 -0
  217. package/src/tests/testLocation.ts +37 -0
  218. package/src/tests/testMiddlewares.ts +159 -0
  219. package/src/tests/testModule.ts +46 -0
  220. package/src/tests/testMulter.ts +140 -0
  221. package/src/tests/testPathParams.ts +122 -0
  222. package/src/tests/testQueryParams.ts +323 -0
  223. package/src/tests/testRedirect.ts +124 -0
  224. package/src/tests/testResponse.ts +558 -0
  225. package/src/tests/testResponseFilter.ts +101 -0
  226. package/src/tests/testRouting.ts +65 -0
  227. package/src/tests/testScopeRequest.ts +111 -0
  228. package/src/tests/testSession.ts +104 -0
  229. package/src/tests/testStatics.ts +61 -0
  230. package/src/tests/testView.ts +68 -0
  231. package/tsconfig.compile.esm.json +12 -0
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PlatformTestSdk = void 0;
4
+ const common_1 = require("@tsed/common");
5
+ const exports_1 = require("../tests/exports");
6
+ class PlatformTestSdk {
7
+ options;
8
+ constructor(options) {
9
+ this.options = options;
10
+ }
11
+ static create(options) {
12
+ return new PlatformTestSdk(options);
13
+ }
14
+ test(name, options = {}) {
15
+ exports_1.specsContainer.get(name)({
16
+ ...this.options,
17
+ ...options
18
+ });
19
+ }
20
+ bootstrap(options = {}) {
21
+ return common_1.PlatformTest.bootstrap(this.options.server, {
22
+ ...this.options,
23
+ ...options
24
+ });
25
+ }
26
+ reset() {
27
+ return common_1.PlatformTest.reset;
28
+ }
29
+ }
30
+ exports.PlatformTestSdk = PlatformTestSdk;
31
+ //# sourceMappingURL=PlatformTestSdk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlatformTestSdk.js","sourceRoot":"","sources":["../../../src/components/PlatformTestSdk.ts"],"names":[],"mappings":";;;AAAA,yCAA0C;AAE1C,8CAAgD;AAEhD,MAAa,eAAe;IACI;IAA9B,YAA8B,OAA+B;QAA/B,YAAO,GAAP,OAAO,CAAwB;IAAG,CAAC;IAEjE,MAAM,CAAC,MAAM,CAAC,OAA+B;QAC3C,OAAO,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;IAED,IAAI,CAAC,IAAY,EAAE,UAAe,EAAE;QAClC,wBAAc,CAAC,GAAG,CAAC,IAAI,CAAE,CAAC;YACxB,GAAG,IAAI,CAAC,OAAO;YACf,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;IAED,SAAS,CAAC,UAAe,EAAE;QACzB,OAAO,qBAAY,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;YACjD,GAAG,IAAI,CAAC,OAAO;YACf,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;IAED,KAAK;QACH,OAAO,qBAAY,CAAC,KAAK,CAAC;IAC5B,CAAC;CACF;AAxBD,0CAwBC","sourcesContent":["import {PlatformTest} from \"@tsed/common\";\nimport {PlatformTestingSdkOpts} from \"../interfaces/index\";\nimport {specsContainer} from \"../tests/exports\";\n\nexport class PlatformTestSdk {\n protected constructor(private options: PlatformTestingSdkOpts) {}\n\n static create(options: PlatformTestingSdkOpts) {\n return new PlatformTestSdk(options);\n }\n\n test(name: string, options: any = {}) {\n specsContainer.get(name)!({\n ...this.options,\n ...options\n });\n }\n\n bootstrap(options: any = {}) {\n return PlatformTest.bootstrap(this.options.server, {\n ...this.options,\n ...options\n });\n }\n\n reset() {\n return PlatformTest.reset;\n }\n}\n"]}
@@ -0,0 +1,32 @@
1
+ {
2
+ "openapi": "3.0.1",
3
+ "info": {
4
+ "version": "1.0.0",
5
+ "description": "Swagger description",
6
+ "title": "Swagger Title",
7
+ "termsOfService": "http://swagger.io/terms/",
8
+ "contact": {
9
+ "email": "apiteam@swagger.io"
10
+ },
11
+ "license": {
12
+ "name": "Apache 2.0",
13
+ "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
14
+ }
15
+ },
16
+ "components": {
17
+ "securitySchemes": {
18
+ "global_auth": {
19
+ "type": "oauth2",
20
+ "flows": {
21
+ "implicit": {
22
+ "authorizationUrl": "http://petstore.swagger.io/oauth/dialog",
23
+ "scopes": {
24
+ "admin": "Admin access"
25
+ }
26
+ }
27
+ }
28
+ }
29
+ }
30
+ },
31
+ "paths": {}
32
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CustomBadRequest = void 0;
4
+ const exceptions_1 = require("@tsed/exceptions");
5
+ class CustomBadRequest extends exceptions_1.BadRequest {
6
+ name = "CUSTOM_BAD_REQUEST";
7
+ errors;
8
+ headers = {};
9
+ constructor(message) {
10
+ super(message);
11
+ this.errors = ["test"];
12
+ this.headers = {
13
+ "X-HEADER-ERROR": "deny"
14
+ };
15
+ }
16
+ }
17
+ exports.CustomBadRequest = CustomBadRequest;
18
+ //# sourceMappingURL=CustomBadRequest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CustomBadRequest.js","sourceRoot":"","sources":["../../../src/errors/CustomBadRequest.ts"],"names":[],"mappings":";;;AACA,iDAA4C;AAE5C,MAAa,gBAAiB,SAAQ,uBAAU;IAC9C,IAAI,GAAG,oBAAoB,CAAC;IAC5B,MAAM,CAAQ;IACd,OAAO,GAAG,EAAE,CAAC;IAEb,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,MAAM,GAAG,CAAC,MAAM,CAAC,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG;YACb,gBAAgB,EAAE,MAAM;SACzB,CAAC;IACJ,CAAC;CACF;AAZD,4CAYC","sourcesContent":["import {ResponseErrorObject} from \"@tsed/common\";\nimport {BadRequest} from \"@tsed/exceptions\";\n\nexport class CustomBadRequest extends BadRequest implements ResponseErrorObject {\n name = \"CUSTOM_BAD_REQUEST\";\n errors: any[];\n headers = {};\n\n constructor(message: string) {\n super(message);\n this.errors = [\"test\"];\n this.headers = {\n \"X-HEADER-ERROR\": \"deny\"\n };\n }\n}\n"]}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CustomInternalError = void 0;
4
+ const exceptions_1 = require("@tsed/exceptions");
5
+ class CustomInternalError extends exceptions_1.InternalServerError {
6
+ name = "CUSTOM_INTERNAL_SERVER_ERROR";
7
+ errors;
8
+ headers = {};
9
+ constructor(message) {
10
+ super(message);
11
+ this.errors = ["test"];
12
+ this.headers = {
13
+ "X-HEADER-ERROR": "deny"
14
+ };
15
+ }
16
+ }
17
+ exports.CustomInternalError = CustomInternalError;
18
+ //# sourceMappingURL=CustomInternalError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CustomInternalError.js","sourceRoot":"","sources":["../../../src/errors/CustomInternalError.ts"],"names":[],"mappings":";;;AACA,iDAAqD;AAErD,MAAa,mBAAoB,SAAQ,gCAAmB;IAC1D,IAAI,GAAG,8BAA8B,CAAC;IACtC,MAAM,CAAQ;IACd,OAAO,GAAG,EAAE,CAAC;IAEb,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,MAAM,GAAG,CAAC,MAAM,CAAC,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG;YACb,gBAAgB,EAAE,MAAM;SACzB,CAAC;IACJ,CAAC;CACF;AAZD,kDAYC","sourcesContent":["import {ResponseErrorObject} from \"@tsed/common\";\nimport {InternalServerError} from \"@tsed/exceptions\";\n\nexport class CustomInternalError extends InternalServerError implements ResponseErrorObject {\n name = \"CUSTOM_INTERNAL_SERVER_ERROR\";\n errors: any[];\n headers = {};\n\n constructor(message: string) {\n super(message);\n this.errors = [\"test\"];\n this.headers = {\n \"X-HEADER-ERROR\": \"deny\"\n };\n }\n}\n"]}
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ /**
3
+ * @file Automatically generated by barrelsby.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const tslib_1 = require("tslib");
7
+ tslib_1.__exportStar(require("./components/PlatformTestSdk"), exports);
8
+ tslib_1.__exportStar(require("./errors/CustomBadRequest"), exports);
9
+ tslib_1.__exportStar(require("./errors/CustomInternalError"), exports);
10
+ tslib_1.__exportStar(require("./interfaces/PlatformTestingSdkOpts"), exports);
11
+ tslib_1.__exportStar(require("./modules/feature/FeatureModule"), exports);
12
+ tslib_1.__exportStar(require("./modules/feature/controllers/FeatureController"), exports);
13
+ tslib_1.__exportStar(require("./tests/exports"), exports);
14
+ tslib_1.__exportStar(require("./tests/testAcceptMime"), exports);
15
+ tslib_1.__exportStar(require("./tests/testAuth"), exports);
16
+ tslib_1.__exportStar(require("./tests/testBodyParams"), exports);
17
+ tslib_1.__exportStar(require("./tests/testCache"), exports);
18
+ tslib_1.__exportStar(require("./tests/testChildrenControllers"), exports);
19
+ tslib_1.__exportStar(require("./tests/testCookies"), exports);
20
+ tslib_1.__exportStar(require("./tests/testCtrlInheritance"), exports);
21
+ tslib_1.__exportStar(require("./tests/testCustom404"), exports);
22
+ tslib_1.__exportStar(require("./tests/testErrors"), exports);
23
+ tslib_1.__exportStar(require("./tests/testHandlers"), exports);
24
+ tslib_1.__exportStar(require("./tests/testHeaderParams"), exports);
25
+ tslib_1.__exportStar(require("./tests/testHeaders"), exports);
26
+ tslib_1.__exportStar(require("./tests/testInheritanceController"), exports);
27
+ tslib_1.__exportStar(require("./tests/testLocals"), exports);
28
+ tslib_1.__exportStar(require("./tests/testLocation"), exports);
29
+ tslib_1.__exportStar(require("./tests/testMiddlewares"), exports);
30
+ tslib_1.__exportStar(require("./tests/testModule"), exports);
31
+ tslib_1.__exportStar(require("./tests/testMulter"), exports);
32
+ tslib_1.__exportStar(require("./tests/testPathParams"), exports);
33
+ tslib_1.__exportStar(require("./tests/testQueryParams"), exports);
34
+ tslib_1.__exportStar(require("./tests/testRedirect"), exports);
35
+ tslib_1.__exportStar(require("./tests/testResponse"), exports);
36
+ tslib_1.__exportStar(require("./tests/testResponseFilter"), exports);
37
+ tslib_1.__exportStar(require("./tests/testRouting"), exports);
38
+ tslib_1.__exportStar(require("./tests/testScopeRequest"), exports);
39
+ tslib_1.__exportStar(require("./tests/testSession"), exports);
40
+ tslib_1.__exportStar(require("./tests/testStatics"), exports);
41
+ tslib_1.__exportStar(require("./tests/testView"), exports);
42
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,uEAA6C;AAC7C,oEAA0C;AAC1C,uEAA6C;AAC7C,8EAAoD;AACpD,0EAAgD;AAChD,0FAAgE;AAChE,0DAAgC;AAChC,iEAAuC;AACvC,2DAAiC;AACjC,iEAAuC;AACvC,4DAAkC;AAClC,0EAAgD;AAChD,8DAAoC;AACpC,sEAA4C;AAC5C,gEAAsC;AACtC,6DAAmC;AACnC,+DAAqC;AACrC,mEAAyC;AACzC,8DAAoC;AACpC,4EAAkD;AAClD,6DAAmC;AACnC,+DAAqC;AACrC,kEAAwC;AACxC,6DAAmC;AACnC,6DAAmC;AACnC,iEAAuC;AACvC,kEAAwC;AACxC,+DAAqC;AACrC,+DAAqC;AACrC,qEAA2C;AAC3C,8DAAoC;AACpC,mEAAyC;AACzC,8DAAoC;AACpC,8DAAoC;AACpC,2DAAiC","sourcesContent":["/**\n * @file Automatically generated by barrelsby.\n */\n\nexport * from \"./components/PlatformTestSdk\";\nexport * from \"./errors/CustomBadRequest\";\nexport * from \"./errors/CustomInternalError\";\nexport * from \"./interfaces/PlatformTestingSdkOpts\";\nexport * from \"./modules/feature/FeatureModule\";\nexport * from \"./modules/feature/controllers/FeatureController\";\nexport * from \"./tests/exports\";\nexport * from \"./tests/testAcceptMime\";\nexport * from \"./tests/testAuth\";\nexport * from \"./tests/testBodyParams\";\nexport * from \"./tests/testCache\";\nexport * from \"./tests/testChildrenControllers\";\nexport * from \"./tests/testCookies\";\nexport * from \"./tests/testCtrlInheritance\";\nexport * from \"./tests/testCustom404\";\nexport * from \"./tests/testErrors\";\nexport * from \"./tests/testHandlers\";\nexport * from \"./tests/testHeaderParams\";\nexport * from \"./tests/testHeaders\";\nexport * from \"./tests/testInheritanceController\";\nexport * from \"./tests/testLocals\";\nexport * from \"./tests/testLocation\";\nexport * from \"./tests/testMiddlewares\";\nexport * from \"./tests/testModule\";\nexport * from \"./tests/testMulter\";\nexport * from \"./tests/testPathParams\";\nexport * from \"./tests/testQueryParams\";\nexport * from \"./tests/testRedirect\";\nexport * from \"./tests/testResponse\";\nexport * from \"./tests/testResponseFilter\";\nexport * from \"./tests/testRouting\";\nexport * from \"./tests/testScopeRequest\";\nexport * from \"./tests/testSession\";\nexport * from \"./tests/testStatics\";\nexport * from \"./tests/testView\";\n"]}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=PlatformTestingSdkOpts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlatformTestingSdkOpts.js","sourceRoot":"","sources":["../../../src/interfaces/PlatformTestingSdkOpts.ts"],"names":[],"mappings":"","sourcesContent":["import {PlatformAdapter} from \"@tsed/common\";\nimport {Type} from \"@tsed/core\";\n\nexport interface PlatformTestingSdkOpts {\n rootDir: string;\n platform: Type<PlatformAdapter<any>>;\n server: Type<any>;\n\n [key: string]: any;\n}\n"]}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ /**
3
+ * @file Automatically generated by barrelsby.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const tslib_1 = require("tslib");
7
+ tslib_1.__exportStar(require("./PlatformTestingSdkOpts"), exports);
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/interfaces/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,mEAAyC","sourcesContent":["/**\n * @file Automatically generated by barrelsby.\n */\n\nexport * from \"./PlatformTestingSdkOpts\";\n"]}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FeatureModule = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const di_1 = require("@tsed/di");
6
+ const FeatureController_1 = require("./controllers/FeatureController");
7
+ let FeatureModule = class FeatureModule {
8
+ };
9
+ FeatureModule = tslib_1.__decorate([
10
+ (0, di_1.Module)({
11
+ mount: {
12
+ "/rest": [FeatureController_1.FeatureController]
13
+ }
14
+ })
15
+ ], FeatureModule);
16
+ exports.FeatureModule = FeatureModule;
17
+ //# sourceMappingURL=FeatureModule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FeatureModule.js","sourceRoot":"","sources":["../../../../src/modules/feature/FeatureModule.ts"],"names":[],"mappings":";;;;AAAA,iCAAgC;AAChC,uEAAkE;AAOlE,IAAa,aAAa,GAA1B,MAAa,aAAa;CAAG,CAAA;AAAhB,aAAa;IALzB,IAAA,WAAM,EAAC;QACN,KAAK,EAAE;YACL,OAAO,EAAE,CAAC,qCAAiB,CAAC;SAC7B;KACF,CAAC;GACW,aAAa,CAAG;AAAhB,sCAAa","sourcesContent":["import {Module} from \"@tsed/di\";\nimport {FeatureController} from \"./controllers/FeatureController\";\n\n@Module({\n mount: {\n \"/rest\": [FeatureController]\n }\n})\nexport class FeatureModule {}\n"]}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FeatureController = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const common_1 = require("@tsed/common");
6
+ const swagger_1 = require("@tsed/swagger");
7
+ let FeatureController = class FeatureController {
8
+ get() {
9
+ return "From feature";
10
+ }
11
+ };
12
+ tslib_1.__decorate([
13
+ (0, common_1.Get)("/"),
14
+ tslib_1.__metadata("design:type", Function),
15
+ tslib_1.__metadata("design:paramtypes", []),
16
+ tslib_1.__metadata("design:returntype", void 0)
17
+ ], FeatureController.prototype, "get", null);
18
+ FeatureController = tslib_1.__decorate([
19
+ (0, swagger_1.Hidden)(),
20
+ (0, common_1.Controller)("/features")
21
+ ], FeatureController);
22
+ exports.FeatureController = FeatureController;
23
+ //# sourceMappingURL=FeatureController.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FeatureController.js","sourceRoot":"","sources":["../../../../../src/modules/feature/controllers/FeatureController.ts"],"names":[],"mappings":";;;;AAAA,yCAA6C;AAC7C,2CAAqC;AAIrC,IAAa,iBAAiB,GAA9B,MAAa,iBAAiB;IAE5B,GAAG;QACD,OAAO,cAAc,CAAC;IACxB,CAAC;CACF,CAAA;AAHC;IADC,IAAA,YAAG,EAAC,GAAG,CAAC;;;;4CAGR;AAJU,iBAAiB;IAF7B,IAAA,gBAAM,GAAE;IACR,IAAA,mBAAU,EAAC,WAAW,CAAC;GACX,iBAAiB,CAK7B;AALY,8CAAiB","sourcesContent":["import {Controller, Get} from \"@tsed/common\";\nimport {Hidden} from \"@tsed/swagger\";\n\n@Hidden()\n@Controller(\"/features\")\nexport class FeatureController {\n @Get(\"/\")\n get() {\n return \"From feature\";\n }\n}\n"]}
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.specsContainer = void 0;
4
+ const testAcceptMime_1 = require("./testAcceptMime");
5
+ const testAuth_1 = require("./testAuth");
6
+ const testBodyParams_1 = require("./testBodyParams");
7
+ const testChildrenControllers_1 = require("./testChildrenControllers");
8
+ const testCookies_1 = require("./testCookies");
9
+ const testCtrlInheritance_1 = require("./testCtrlInheritance");
10
+ const testCustom404_1 = require("./testCustom404");
11
+ const testErrors_1 = require("./testErrors");
12
+ const testHandlers_1 = require("./testHandlers");
13
+ const testHeaderParams_1 = require("./testHeaderParams");
14
+ const testHeaders_1 = require("./testHeaders");
15
+ const testInheritanceController_1 = require("./testInheritanceController");
16
+ const testLocals_1 = require("./testLocals");
17
+ const testLocation_1 = require("./testLocation");
18
+ const testMiddlewares_1 = require("./testMiddlewares");
19
+ const testModule_1 = require("./testModule");
20
+ const testMulter_1 = require("./testMulter");
21
+ const testPathParams_1 = require("./testPathParams");
22
+ const testQueryParams_1 = require("./testQueryParams");
23
+ const testRedirect_1 = require("./testRedirect");
24
+ const testResponse_1 = require("./testResponse");
25
+ const testResponseFilter_1 = require("./testResponseFilter");
26
+ const testRouting_1 = require("./testRouting");
27
+ const testScopeRequest_1 = require("./testScopeRequest");
28
+ const testSession_1 = require("./testSession");
29
+ const testStatics_1 = require("./testStatics");
30
+ const testView_1 = require("./testView");
31
+ const testCache_1 = require("./testCache");
32
+ exports.specsContainer = new Map();
33
+ // HANDLERS AND MIDDLEWARES
34
+ exports.specsContainer.set("handlers", testHandlers_1.testHandlers);
35
+ exports.specsContainer.set("auth", testAuth_1.testAuth);
36
+ exports.specsContainer.set("middlewares", testMiddlewares_1.testMiddlewares);
37
+ // RESPONSES
38
+ exports.specsContainer.set("headers", testHeaders_1.testHeaders);
39
+ exports.specsContainer.set("acceptMime", testAcceptMime_1.testAcceptMime);
40
+ exports.specsContainer.set("location", testLocation_1.testLocation);
41
+ exports.specsContainer.set("redirect", testRedirect_1.testRedirect);
42
+ exports.specsContainer.set("view", testView_1.testView);
43
+ exports.specsContainer.set("errors", testErrors_1.testErrors);
44
+ exports.specsContainer.set("response", testResponse_1.testResponse);
45
+ exports.specsContainer.set("responseFilter", testResponseFilter_1.testResponseFilter);
46
+ exports.specsContainer.set("custom404", testCustom404_1.testCustom404);
47
+ exports.specsContainer.set("statics", testStatics_1.testStatics);
48
+ exports.specsContainer.set("cache", testCache_1.testCache);
49
+ // INPUTS
50
+ exports.specsContainer.set("cookies", testCookies_1.testCookies);
51
+ exports.specsContainer.set("session", testSession_1.testSession);
52
+ exports.specsContainer.set("headerParams", testHeaderParams_1.testHeaderParams);
53
+ exports.specsContainer.set("bodyParams", testBodyParams_1.testBodyParams);
54
+ exports.specsContainer.set("pathParams", testPathParams_1.testPathParams);
55
+ exports.specsContainer.set("queryParams", testQueryParams_1.testQueryParams);
56
+ exports.specsContainer.set("locals", testLocals_1.testLocals);
57
+ exports.specsContainer.set("multer", testMulter_1.testMulter);
58
+ // ROUTING
59
+ exports.specsContainer.set("scopeRequest", testScopeRequest_1.testScopeRequest);
60
+ exports.specsContainer.set("routing", testRouting_1.testRouting);
61
+ exports.specsContainer.set("inheritance", testCtrlInheritance_1.testCtrlInheritance);
62
+ // CODE ORGANIZATION
63
+ exports.specsContainer.set("childrenControllers", testChildrenControllers_1.testChildrenControllers);
64
+ exports.specsContainer.set("inheritanceController", testInheritanceController_1.testInheritanceController);
65
+ exports.specsContainer.set("module", testModule_1.testModule);
66
+ //# sourceMappingURL=exports.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exports.js","sourceRoot":"","sources":["../../../src/tests/exports.ts"],"names":[],"mappings":";;;AACA,qDAAgD;AAChD,yCAAoC;AACpC,qDAAgD;AAChD,uEAAkE;AAClE,+CAA0C;AAC1C,+DAA0D;AAC1D,mDAA8C;AAC9C,6CAAwC;AACxC,iDAA4C;AAC5C,yDAAoD;AACpD,+CAA0C;AAC1C,2EAAsE;AACtE,6CAAwC;AACxC,iDAA4C;AAC5C,uDAAkD;AAClD,6CAAwC;AACxC,6CAAwC;AACxC,qDAAgD;AAChD,uDAAkD;AAClD,iDAA4C;AAC5C,iDAA4C;AAC5C,6DAAwD;AACxD,+CAA0C;AAC1C,yDAAoD;AACpD,+CAA0C;AAC1C,+CAA0C;AAC1C,yCAAoC;AACpC,2CAAsC;AAEzB,QAAA,cAAc,GAAG,IAAI,GAAG,EAAqD,CAAC;AAE3F,2BAA2B;AAC3B,sBAAc,CAAC,GAAG,CAAC,UAAU,EAAE,2BAAY,CAAC,CAAC;AAC7C,sBAAc,CAAC,GAAG,CAAC,MAAM,EAAE,mBAAQ,CAAC,CAAC;AACrC,sBAAc,CAAC,GAAG,CAAC,aAAa,EAAE,iCAAe,CAAC,CAAC;AAEnD,YAAY;AACZ,sBAAc,CAAC,GAAG,CAAC,SAAS,EAAE,yBAAW,CAAC,CAAC;AAC3C,sBAAc,CAAC,GAAG,CAAC,YAAY,EAAE,+BAAc,CAAC,CAAC;AACjD,sBAAc,CAAC,GAAG,CAAC,UAAU,EAAE,2BAAY,CAAC,CAAC;AAC7C,sBAAc,CAAC,GAAG,CAAC,UAAU,EAAE,2BAAY,CAAC,CAAC;AAC7C,sBAAc,CAAC,GAAG,CAAC,MAAM,EAAE,mBAAQ,CAAC,CAAC;AACrC,sBAAc,CAAC,GAAG,CAAC,QAAQ,EAAE,uBAAU,CAAC,CAAC;AACzC,sBAAc,CAAC,GAAG,CAAC,UAAU,EAAE,2BAAY,CAAC,CAAC;AAC7C,sBAAc,CAAC,GAAG,CAAC,gBAAgB,EAAE,uCAAkB,CAAC,CAAC;AACzD,sBAAc,CAAC,GAAG,CAAC,WAAW,EAAE,6BAAa,CAAC,CAAC;AAC/C,sBAAc,CAAC,GAAG,CAAC,SAAS,EAAE,yBAAW,CAAC,CAAC;AAC3C,sBAAc,CAAC,GAAG,CAAC,OAAO,EAAE,qBAAS,CAAC,CAAC;AAEvC,SAAS;AACT,sBAAc,CAAC,GAAG,CAAC,SAAS,EAAE,yBAAW,CAAC,CAAC;AAC3C,sBAAc,CAAC,GAAG,CAAC,SAAS,EAAE,yBAAW,CAAC,CAAC;AAC3C,sBAAc,CAAC,GAAG,CAAC,cAAc,EAAE,mCAAgB,CAAC,CAAC;AACrD,sBAAc,CAAC,GAAG,CAAC,YAAY,EAAE,+BAAc,CAAC,CAAC;AACjD,sBAAc,CAAC,GAAG,CAAC,YAAY,EAAE,+BAAc,CAAC,CAAC;AACjD,sBAAc,CAAC,GAAG,CAAC,aAAa,EAAE,iCAAe,CAAC,CAAC;AACnD,sBAAc,CAAC,GAAG,CAAC,QAAQ,EAAE,uBAAU,CAAC,CAAC;AACzC,sBAAc,CAAC,GAAG,CAAC,QAAQ,EAAE,uBAAU,CAAC,CAAC;AAEzC,UAAU;AACV,sBAAc,CAAC,GAAG,CAAC,cAAc,EAAE,mCAAgB,CAAC,CAAC;AACrD,sBAAc,CAAC,GAAG,CAAC,SAAS,EAAE,yBAAW,CAAC,CAAC;AAC3C,sBAAc,CAAC,GAAG,CAAC,aAAa,EAAE,yCAAmB,CAAC,CAAC;AAEvD,oBAAoB;AACpB,sBAAc,CAAC,GAAG,CAAC,qBAAqB,EAAE,iDAAuB,CAAC,CAAC;AACnE,sBAAc,CAAC,GAAG,CAAC,uBAAuB,EAAE,qDAAyB,CAAC,CAAC;AACvE,sBAAc,CAAC,GAAG,CAAC,QAAQ,EAAE,uBAAU,CAAC,CAAC","sourcesContent":["import {PlatformTestingSdkOpts} from \"../interfaces\";\nimport {testAcceptMime} from \"./testAcceptMime\";\nimport {testAuth} from \"./testAuth\";\nimport {testBodyParams} from \"./testBodyParams\";\nimport {testChildrenControllers} from \"./testChildrenControllers\";\nimport {testCookies} from \"./testCookies\";\nimport {testCtrlInheritance} from \"./testCtrlInheritance\";\nimport {testCustom404} from \"./testCustom404\";\nimport {testErrors} from \"./testErrors\";\nimport {testHandlers} from \"./testHandlers\";\nimport {testHeaderParams} from \"./testHeaderParams\";\nimport {testHeaders} from \"./testHeaders\";\nimport {testInheritanceController} from \"./testInheritanceController\";\nimport {testLocals} from \"./testLocals\";\nimport {testLocation} from \"./testLocation\";\nimport {testMiddlewares} from \"./testMiddlewares\";\nimport {testModule} from \"./testModule\";\nimport {testMulter} from \"./testMulter\";\nimport {testPathParams} from \"./testPathParams\";\nimport {testQueryParams} from \"./testQueryParams\";\nimport {testRedirect} from \"./testRedirect\";\nimport {testResponse} from \"./testResponse\";\nimport {testResponseFilter} from \"./testResponseFilter\";\nimport {testRouting} from \"./testRouting\";\nimport {testScopeRequest} from \"./testScopeRequest\";\nimport {testSession} from \"./testSession\";\nimport {testStatics} from \"./testStatics\";\nimport {testView} from \"./testView\";\nimport {testCache} from \"./testCache\";\n\nexport const specsContainer = new Map<string, (options: PlatformTestingSdkOpts) => void>();\n\n// HANDLERS AND MIDDLEWARES\nspecsContainer.set(\"handlers\", testHandlers);\nspecsContainer.set(\"auth\", testAuth);\nspecsContainer.set(\"middlewares\", testMiddlewares);\n\n// RESPONSES\nspecsContainer.set(\"headers\", testHeaders);\nspecsContainer.set(\"acceptMime\", testAcceptMime);\nspecsContainer.set(\"location\", testLocation);\nspecsContainer.set(\"redirect\", testRedirect);\nspecsContainer.set(\"view\", testView);\nspecsContainer.set(\"errors\", testErrors);\nspecsContainer.set(\"response\", testResponse);\nspecsContainer.set(\"responseFilter\", testResponseFilter);\nspecsContainer.set(\"custom404\", testCustom404);\nspecsContainer.set(\"statics\", testStatics);\nspecsContainer.set(\"cache\", testCache);\n\n// INPUTS\nspecsContainer.set(\"cookies\", testCookies);\nspecsContainer.set(\"session\", testSession);\nspecsContainer.set(\"headerParams\", testHeaderParams);\nspecsContainer.set(\"bodyParams\", testBodyParams);\nspecsContainer.set(\"pathParams\", testPathParams);\nspecsContainer.set(\"queryParams\", testQueryParams);\nspecsContainer.set(\"locals\", testLocals);\nspecsContainer.set(\"multer\", testMulter);\n\n// ROUTING\nspecsContainer.set(\"scopeRequest\", testScopeRequest);\nspecsContainer.set(\"routing\", testRouting);\nspecsContainer.set(\"inheritance\", testCtrlInheritance);\n\n// CODE ORGANIZATION\nspecsContainer.set(\"childrenControllers\", testChildrenControllers);\nspecsContainer.set(\"inheritanceController\", testInheritanceController);\nspecsContainer.set(\"module\", testModule);\n"]}
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.testAcceptMime = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const common_1 = require("@tsed/common");
6
+ const schema_1 = require("@tsed/schema");
7
+ const supertest_1 = tslib_1.__importDefault(require("supertest"));
8
+ let TestAcceptMimeCtrl = class TestAcceptMimeCtrl {
9
+ scenario1(accept) {
10
+ return {
11
+ accept
12
+ };
13
+ }
14
+ ping() {
15
+ return "pong";
16
+ }
17
+ };
18
+ tslib_1.__decorate([
19
+ (0, common_1.Post)("/scenario-1"),
20
+ (0, common_1.AcceptMime)("application/json"),
21
+ tslib_1.__param(0, (0, common_1.HeaderParams)("Accept")),
22
+ tslib_1.__metadata("design:type", Function),
23
+ tslib_1.__metadata("design:paramtypes", [String]),
24
+ tslib_1.__metadata("design:returntype", void 0)
25
+ ], TestAcceptMimeCtrl.prototype, "scenario1", null);
26
+ tslib_1.__decorate([
27
+ (0, common_1.Get)("/scenario-2"),
28
+ (0, schema_1.ContentType)("text"),
29
+ (0, common_1.AcceptMime)("text"),
30
+ tslib_1.__metadata("design:type", Function),
31
+ tslib_1.__metadata("design:paramtypes", []),
32
+ tslib_1.__metadata("design:returntype", void 0)
33
+ ], TestAcceptMimeCtrl.prototype, "ping", null);
34
+ TestAcceptMimeCtrl = tslib_1.__decorate([
35
+ (0, common_1.Controller)("/accept-mime")
36
+ ], TestAcceptMimeCtrl);
37
+ function testAcceptMime(options) {
38
+ let request;
39
+ beforeAll(common_1.PlatformTest.bootstrap(options.server, {
40
+ ...options,
41
+ mount: {
42
+ "/rest": [TestAcceptMimeCtrl]
43
+ }
44
+ }));
45
+ beforeAll(() => {
46
+ request = (0, supertest_1.default)(common_1.PlatformTest.callback());
47
+ });
48
+ afterAll(common_1.PlatformTest.reset);
49
+ describe("Scenario 1: POST /rest/accept-mime/scenario-1", () => {
50
+ it('should return a 200 response when Accept header match with @AcceptMime("application/json")', async () => {
51
+ const response = await request
52
+ .post("/rest/accept-mime/scenario-1")
53
+ .set({
54
+ Accept: "application/json"
55
+ })
56
+ .expect(200);
57
+ expect(response.body).toEqual({
58
+ accept: "application/json"
59
+ });
60
+ });
61
+ it('should return a 406 response when Accept header doesn\'t match with @AcceptMime("application/json")', async () => {
62
+ const response = await request
63
+ .post("/rest/accept-mime/scenario-1")
64
+ .set({
65
+ Accept: "application/xml"
66
+ })
67
+ .expect(406);
68
+ expect(response.body).toEqual({
69
+ name: "NOT_ACCEPTABLE",
70
+ message: "You must accept content-type application/json",
71
+ status: 406,
72
+ errors: []
73
+ });
74
+ });
75
+ });
76
+ describe("Scenario 2: GET /rest/accept-mime/scenario-2", () => {
77
+ it('should return a 200 response when Accept header match with @AcceptMime("text")', async () => {
78
+ const response = await request
79
+ .get("/rest/accept-mime/scenario-2")
80
+ .set({
81
+ Accept: "text/*, application/json"
82
+ })
83
+ .expect(200);
84
+ expect(response.text).toEqual("pong");
85
+ });
86
+ it('should return a 406 response when Accept header doesn\'t match with @AcceptMime("text")', async () => {
87
+ const response = await request
88
+ .get("/rest/accept-mime/scenario-2")
89
+ .set({
90
+ Accept: "application/xml"
91
+ })
92
+ .expect(406);
93
+ expect(response.body).toEqual({
94
+ name: "NOT_ACCEPTABLE",
95
+ message: "You must accept content-type text",
96
+ status: 406,
97
+ errors: []
98
+ });
99
+ });
100
+ });
101
+ }
102
+ exports.testAcceptMime = testAcceptMime;
103
+ //# sourceMappingURL=testAcceptMime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testAcceptMime.js","sourceRoot":"","sources":["../../../src/tests/testAcceptMime.ts"],"names":[],"mappings":"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","sourcesContent":["import {AcceptMime, Controller, Get, HeaderParams, PlatformTest, Post} from \"@tsed/common\";\nimport {ContentType} from \"@tsed/schema\";\nimport SuperTest from \"supertest\";\nimport {PlatformTestingSdkOpts} from \"../interfaces\";\n\n@Controller(\"/accept-mime\")\nclass TestAcceptMimeCtrl {\n @Post(\"/scenario-1\")\n @AcceptMime(\"application/json\")\n scenario1(@HeaderParams(\"Accept\") accept: string) {\n return {\n accept\n };\n }\n\n @Get(\"/scenario-2\")\n @ContentType(\"text\")\n @AcceptMime(\"text\")\n public ping() {\n return \"pong\";\n }\n}\n\nexport function testAcceptMime(options: PlatformTestingSdkOpts) {\n let request: SuperTest.SuperTest<SuperTest.Test>;\n\n beforeAll(\n PlatformTest.bootstrap(options.server, {\n ...options,\n mount: {\n \"/rest\": [TestAcceptMimeCtrl]\n }\n })\n );\n beforeAll(() => {\n request = SuperTest(PlatformTest.callback());\n });\n afterAll(PlatformTest.reset);\n describe(\"Scenario 1: POST /rest/accept-mime/scenario-1\", () => {\n it('should return a 200 response when Accept header match with @AcceptMime(\"application/json\")', async () => {\n const response = await request\n .post(\"/rest/accept-mime/scenario-1\")\n .set({\n Accept: \"application/json\"\n })\n .expect(200);\n\n expect(response.body).toEqual({\n accept: \"application/json\"\n });\n });\n it('should return a 406 response when Accept header doesn\\'t match with @AcceptMime(\"application/json\")', async () => {\n const response = await request\n .post(\"/rest/accept-mime/scenario-1\")\n .set({\n Accept: \"application/xml\"\n })\n .expect(406);\n\n expect(response.body).toEqual({\n name: \"NOT_ACCEPTABLE\",\n message: \"You must accept content-type application/json\",\n status: 406,\n errors: []\n });\n });\n });\n describe(\"Scenario 2: GET /rest/accept-mime/scenario-2\", () => {\n it('should return a 200 response when Accept header match with @AcceptMime(\"text\")', async () => {\n const response = await request\n .get(\"/rest/accept-mime/scenario-2\")\n .set({\n Accept: \"text/*, application/json\"\n })\n .expect(200);\n\n expect(response.text).toEqual(\"pong\");\n });\n it('should return a 406 response when Accept header doesn\\'t match with @AcceptMime(\"text\")', async () => {\n const response = await request\n .get(\"/rest/accept-mime/scenario-2\")\n .set({\n Accept: \"application/xml\"\n })\n .expect(406);\n\n expect(response.body).toEqual({\n name: \"NOT_ACCEPTABLE\",\n message: \"You must accept content-type text\",\n status: 406,\n errors: []\n });\n });\n });\n}\n"]}