@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.
- package/lib/cjs/components/PlatformTestSdk.js +31 -0
- package/lib/cjs/components/PlatformTestSdk.js.map +1 -0
- package/lib/cjs/data/swagger.json +32 -0
- package/lib/cjs/errors/CustomBadRequest.js +18 -0
- package/lib/cjs/errors/CustomBadRequest.js.map +1 -0
- package/lib/cjs/errors/CustomInternalError.js +18 -0
- package/lib/cjs/errors/CustomInternalError.js.map +1 -0
- package/lib/cjs/index.js +42 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/interfaces/PlatformTestingSdkOpts.js +3 -0
- package/lib/cjs/interfaces/PlatformTestingSdkOpts.js.map +1 -0
- package/lib/cjs/interfaces/index.js +8 -0
- package/lib/cjs/interfaces/index.js.map +1 -0
- package/lib/cjs/modules/feature/FeatureModule.js +17 -0
- package/lib/cjs/modules/feature/FeatureModule.js.map +1 -0
- package/lib/cjs/modules/feature/controllers/FeatureController.js +23 -0
- package/lib/cjs/modules/feature/controllers/FeatureController.js.map +1 -0
- package/lib/cjs/package.json +3 -0
- package/lib/cjs/tests/exports.js +66 -0
- package/lib/cjs/tests/exports.js.map +1 -0
- package/lib/cjs/tests/testAcceptMime.js +103 -0
- package/lib/cjs/tests/testAcceptMime.js.map +1 -0
- package/lib/cjs/tests/testAuth.js +343 -0
- package/lib/cjs/tests/testAuth.js.map +1 -0
- package/lib/cjs/tests/testBodyParams.js +526 -0
- package/lib/cjs/tests/testBodyParams.js.map +1 -0
- package/lib/cjs/tests/testCache.js +292 -0
- package/lib/cjs/tests/testCache.js.map +1 -0
- package/lib/cjs/tests/testChildrenControllers.js +64 -0
- package/lib/cjs/tests/testChildrenControllers.js.map +1 -0
- package/lib/cjs/tests/testCookies.js +45 -0
- package/lib/cjs/tests/testCookies.js.map +1 -0
- package/lib/cjs/tests/testCtrlInheritance.js +161 -0
- package/lib/cjs/tests/testCtrlInheritance.js.map +1 -0
- package/lib/cjs/tests/testCustom404.js +32 -0
- package/lib/cjs/tests/testCustom404.js.map +1 -0
- package/lib/cjs/tests/testErrors.js +252 -0
- package/lib/cjs/tests/testErrors.js.map +1 -0
- package/lib/cjs/tests/testHandlers.js +110 -0
- package/lib/cjs/tests/testHandlers.js.map +1 -0
- package/lib/cjs/tests/testHeaderParams.js +166 -0
- package/lib/cjs/tests/testHeaderParams.js.map +1 -0
- package/lib/cjs/tests/testHeaders.js +101 -0
- package/lib/cjs/tests/testHeaders.js.map +1 -0
- package/lib/cjs/tests/testInheritanceController.js +173 -0
- package/lib/cjs/tests/testInheritanceController.js.map +1 -0
- package/lib/cjs/tests/testLocals.js +63 -0
- package/lib/cjs/tests/testLocals.js.map +1 -0
- package/lib/cjs/tests/testLocation.js +42 -0
- package/lib/cjs/tests/testLocation.js.map +1 -0
- package/lib/cjs/tests/testMiddlewares.js +210 -0
- package/lib/cjs/tests/testMiddlewares.js.map +1 -0
- package/lib/cjs/tests/testModule.js +49 -0
- package/lib/cjs/tests/testModule.js.map +1 -0
- package/lib/cjs/tests/testMulter.js +162 -0
- package/lib/cjs/tests/testMulter.js.map +1 -0
- package/lib/cjs/tests/testPathParams.js +142 -0
- package/lib/cjs/tests/testPathParams.js.map +1 -0
- package/lib/cjs/tests/testQueryParams.js +354 -0
- package/lib/cjs/tests/testQueryParams.js.map +1 -0
- package/lib/cjs/tests/testRedirect.js +143 -0
- package/lib/cjs/tests/testRedirect.js.map +1 -0
- package/lib/cjs/tests/testResponse.js +622 -0
- package/lib/cjs/tests/testResponse.js.map +1 -0
- package/lib/cjs/tests/testResponseFilter.js +107 -0
- package/lib/cjs/tests/testResponseFilter.js.map +1 -0
- package/lib/cjs/tests/testRouting.js +75 -0
- package/lib/cjs/tests/testRouting.js.map +1 -0
- package/lib/cjs/tests/testScopeRequest.js +116 -0
- package/lib/cjs/tests/testScopeRequest.js.map +1 -0
- package/lib/cjs/tests/testSession.js +128 -0
- package/lib/cjs/tests/testSession.js.map +1 -0
- package/lib/cjs/tests/testStatics.js +58 -0
- package/lib/cjs/tests/testStatics.js.map +1 -0
- package/lib/cjs/tests/testView.js +83 -0
- package/lib/cjs/tests/testView.js.map +1 -0
- package/lib/esm/components/PlatformTestSdk.js +27 -0
- package/lib/esm/components/PlatformTestSdk.js.map +1 -0
- package/lib/esm/data/swagger.json +32 -0
- package/lib/esm/errors/CustomBadRequest.js +14 -0
- package/lib/esm/errors/CustomBadRequest.js.map +1 -0
- package/lib/esm/errors/CustomInternalError.js +14 -0
- package/lib/esm/errors/CustomInternalError.js.map +1 -0
- package/lib/esm/index.js +39 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/interfaces/PlatformTestingSdkOpts.js +2 -0
- package/lib/esm/interfaces/PlatformTestingSdkOpts.js.map +1 -0
- package/lib/esm/interfaces/index.js +5 -0
- package/lib/esm/interfaces/index.js.map +1 -0
- package/lib/esm/modules/feature/FeatureModule.js +14 -0
- package/lib/esm/modules/feature/FeatureModule.js.map +1 -0
- package/lib/esm/modules/feature/controllers/FeatureController.js +20 -0
- package/lib/esm/modules/feature/controllers/FeatureController.js.map +1 -0
- package/lib/esm/package.json +3 -0
- package/lib/esm/tests/exports.js +63 -0
- package/lib/esm/tests/exports.js.map +1 -0
- package/lib/esm/tests/testAcceptMime.js +99 -0
- package/lib/esm/tests/testAcceptMime.js.map +1 -0
- package/lib/esm/tests/testAuth.js +338 -0
- package/lib/esm/tests/testAuth.js.map +1 -0
- package/lib/esm/tests/testBodyParams.js +522 -0
- package/lib/esm/tests/testBodyParams.js.map +1 -0
- package/lib/esm/tests/testCache.js +288 -0
- package/lib/esm/tests/testCache.js.map +1 -0
- package/lib/esm/tests/testChildrenControllers.js +60 -0
- package/lib/esm/tests/testChildrenControllers.js.map +1 -0
- package/lib/esm/tests/testCookies.js +41 -0
- package/lib/esm/tests/testCookies.js.map +1 -0
- package/lib/esm/tests/testCtrlInheritance.js +156 -0
- package/lib/esm/tests/testCtrlInheritance.js.map +1 -0
- package/lib/esm/tests/testCustom404.js +27 -0
- package/lib/esm/tests/testCustom404.js.map +1 -0
- package/lib/esm/tests/testErrors.js +248 -0
- package/lib/esm/tests/testErrors.js.map +1 -0
- package/lib/esm/tests/testHandlers.js +105 -0
- package/lib/esm/tests/testHandlers.js.map +1 -0
- package/lib/esm/tests/testHeaderParams.js +162 -0
- package/lib/esm/tests/testHeaderParams.js.map +1 -0
- package/lib/esm/tests/testHeaders.js +97 -0
- package/lib/esm/tests/testHeaders.js.map +1 -0
- package/lib/esm/tests/testInheritanceController.js +167 -0
- package/lib/esm/tests/testInheritanceController.js.map +1 -0
- package/lib/esm/tests/testLocals.js +59 -0
- package/lib/esm/tests/testLocals.js.map +1 -0
- package/lib/esm/tests/testLocation.js +38 -0
- package/lib/esm/tests/testLocation.js.map +1 -0
- package/lib/esm/tests/testMiddlewares.js +206 -0
- package/lib/esm/tests/testMiddlewares.js.map +1 -0
- package/lib/esm/tests/testModule.js +45 -0
- package/lib/esm/tests/testModule.js.map +1 -0
- package/lib/esm/tests/testMulter.js +156 -0
- package/lib/esm/tests/testMulter.js.map +1 -0
- package/lib/esm/tests/testPathParams.js +138 -0
- package/lib/esm/tests/testPathParams.js.map +1 -0
- package/lib/esm/tests/testQueryParams.js +349 -0
- package/lib/esm/tests/testQueryParams.js.map +1 -0
- package/lib/esm/tests/testRedirect.js +139 -0
- package/lib/esm/tests/testRedirect.js.map +1 -0
- package/lib/esm/tests/testResponse.js +615 -0
- package/lib/esm/tests/testResponse.js.map +1 -0
- package/lib/esm/tests/testResponseFilter.js +103 -0
- package/lib/esm/tests/testResponseFilter.js.map +1 -0
- package/lib/esm/tests/testRouting.js +71 -0
- package/lib/esm/tests/testRouting.js.map +1 -0
- package/lib/esm/tests/testScopeRequest.js +112 -0
- package/lib/esm/tests/testScopeRequest.js.map +1 -0
- package/lib/esm/tests/testSession.js +122 -0
- package/lib/esm/tests/testSession.js.map +1 -0
- package/lib/esm/tests/testStatics.js +54 -0
- package/lib/esm/tests/testStatics.js.map +1 -0
- package/lib/esm/tests/testView.js +79 -0
- package/lib/esm/tests/testView.js.map +1 -0
- package/lib/types/components/PlatformTestSdk.d.ts +9 -0
- package/lib/types/errors/CustomBadRequest.d.ts +8 -0
- package/lib/types/errors/CustomInternalError.d.ts +8 -0
- package/lib/types/index.d.ts +38 -0
- package/lib/types/interfaces/PlatformTestingSdkOpts.d.ts +8 -0
- package/lib/types/interfaces/index.d.ts +4 -0
- package/lib/types/modules/feature/FeatureModule.d.ts +2 -0
- package/lib/types/modules/feature/controllers/FeatureController.d.ts +3 -0
- package/lib/types/tests/exports.d.ts +2 -0
- package/lib/types/tests/testAcceptMime.d.ts +2 -0
- package/lib/types/tests/testAuth.d.ts +8 -0
- package/lib/types/tests/testBodyParams.d.ts +3 -0
- package/lib/types/tests/testCache.d.ts +2 -0
- package/lib/types/tests/testChildrenControllers.d.ts +2 -0
- package/lib/types/tests/testCookies.d.ts +11 -0
- package/lib/types/tests/testCtrlInheritance.d.ts +18 -0
- package/lib/types/tests/testCustom404.d.ts +2 -0
- package/lib/types/tests/testErrors.d.ts +19 -0
- package/lib/types/tests/testHandlers.d.ts +12 -0
- package/lib/types/tests/testHeaderParams.d.ts +16 -0
- package/lib/types/tests/testHeaders.d.ts +8 -0
- package/lib/types/tests/testInheritanceController.d.ts +28 -0
- package/lib/types/tests/testLocals.d.ts +2 -0
- package/lib/types/tests/testLocation.d.ts +2 -0
- package/lib/types/tests/testMiddlewares.d.ts +8 -0
- package/lib/types/tests/testModule.d.ts +2 -0
- package/lib/types/tests/testMulter.d.ts +21 -0
- package/lib/types/tests/testPathParams.d.ts +2 -0
- package/lib/types/tests/testQueryParams.d.ts +6 -0
- package/lib/types/tests/testRedirect.d.ts +2 -0
- package/lib/types/tests/testResponse.d.ts +16 -0
- package/lib/types/tests/testResponseFilter.d.ts +2 -0
- package/lib/types/tests/testRouting.d.ts +7 -0
- package/lib/types/tests/testScopeRequest.d.ts +12 -0
- package/lib/types/tests/testSession.d.ts +16 -0
- package/lib/types/tests/testStatics.d.ts +2 -0
- package/lib/types/tests/testView.d.ts +2 -0
- package/package.json +44 -0
- package/src/components/PlatformTestSdk.ts +29 -0
- package/src/data/file.txt +1 -0
- package/src/data/response.data.json +3 -0
- package/src/data/swagger.json +32 -0
- package/src/errors/CustomBadRequest.ts +16 -0
- package/src/errors/CustomInternalError.ts +16 -0
- package/src/index.ts +39 -0
- package/src/interfaces/PlatformTestingSdkOpts.ts +10 -0
- package/src/interfaces/index.ts +5 -0
- package/src/modules/feature/FeatureModule.ts +9 -0
- package/src/modules/feature/controllers/FeatureController.ts +11 -0
- package/src/tests/exports.ts +69 -0
- package/src/tests/testAcceptMime.ts +95 -0
- package/src/tests/testAuth.ts +339 -0
- package/src/tests/testBodyParams.ts +455 -0
- package/src/tests/testCache.ts +270 -0
- package/src/tests/testChildrenControllers.ts +55 -0
- package/src/tests/testCookies.ts +36 -0
- package/src/tests/testCtrlInheritance.ts +140 -0
- package/src/tests/testCustom404.ts +33 -0
- package/src/tests/testErrors.ts +223 -0
- package/src/tests/testHandlers.ts +92 -0
- package/src/tests/testHeaderParams.ts +149 -0
- package/src/tests/testHeaders.ts +91 -0
- package/src/tests/testInheritanceController.ts +156 -0
- package/src/tests/testLocals.ts +46 -0
- package/src/tests/testLocation.ts +37 -0
- package/src/tests/testMiddlewares.ts +159 -0
- package/src/tests/testModule.ts +46 -0
- package/src/tests/testMulter.ts +140 -0
- package/src/tests/testPathParams.ts +122 -0
- package/src/tests/testQueryParams.ts +323 -0
- package/src/tests/testRedirect.ts +124 -0
- package/src/tests/testResponse.ts +558 -0
- package/src/tests/testResponseFilter.ts +101 -0
- package/src/tests/testRouting.ts +65 -0
- package/src/tests/testScopeRequest.ts +111 -0
- package/src/tests/testSession.ts +104 -0
- package/src/tests/testStatics.ts +61 -0
- package/src/tests/testView.ts +68 -0
- package/tsconfig.compile.esm.json +12 -0
|
@@ -0,0 +1,526 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.testBodyParams = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
require("@tsed/ajv");
|
|
6
|
+
const common_1 = require("@tsed/common");
|
|
7
|
+
const schema_1 = require("@tsed/schema");
|
|
8
|
+
const supertest_1 = tslib_1.__importDefault(require("supertest"));
|
|
9
|
+
var MyEnum;
|
|
10
|
+
(function (MyEnum) {
|
|
11
|
+
MyEnum[MyEnum["TITLE"] = 0] = "TITLE";
|
|
12
|
+
MyEnum[MyEnum["AGE"] = 1] = "AGE";
|
|
13
|
+
})(MyEnum || (MyEnum = {}));
|
|
14
|
+
class NestedModel {
|
|
15
|
+
id;
|
|
16
|
+
}
|
|
17
|
+
tslib_1.__decorate([
|
|
18
|
+
(0, schema_1.Property)(),
|
|
19
|
+
tslib_1.__metadata("design:type", String)
|
|
20
|
+
], NestedModel.prototype, "id", void 0);
|
|
21
|
+
class NullModel {
|
|
22
|
+
prop1;
|
|
23
|
+
prop2;
|
|
24
|
+
prop3;
|
|
25
|
+
prop4;
|
|
26
|
+
}
|
|
27
|
+
tslib_1.__decorate([
|
|
28
|
+
(0, schema_1.Property)(),
|
|
29
|
+
tslib_1.__metadata("design:type", String)
|
|
30
|
+
], NullModel.prototype, "prop1", void 0);
|
|
31
|
+
tslib_1.__decorate([
|
|
32
|
+
(0, schema_1.Property)(),
|
|
33
|
+
tslib_1.__metadata("design:type", Number)
|
|
34
|
+
], NullModel.prototype, "prop2", void 0);
|
|
35
|
+
tslib_1.__decorate([
|
|
36
|
+
(0, schema_1.Property)(),
|
|
37
|
+
tslib_1.__metadata("design:type", Date)
|
|
38
|
+
], NullModel.prototype, "prop3", void 0);
|
|
39
|
+
tslib_1.__decorate([
|
|
40
|
+
(0, schema_1.Nullable)(NestedModel),
|
|
41
|
+
tslib_1.__metadata("design:type", NestedModel)
|
|
42
|
+
], NullModel.prototype, "prop4", void 0);
|
|
43
|
+
class FindQuery {
|
|
44
|
+
a;
|
|
45
|
+
b;
|
|
46
|
+
}
|
|
47
|
+
tslib_1.__decorate([
|
|
48
|
+
(0, schema_1.Property)(),
|
|
49
|
+
tslib_1.__metadata("design:type", String)
|
|
50
|
+
], FindQuery.prototype, "a", void 0);
|
|
51
|
+
tslib_1.__decorate([
|
|
52
|
+
(0, schema_1.Property)(),
|
|
53
|
+
tslib_1.__metadata("design:type", String)
|
|
54
|
+
], FindQuery.prototype, "b", void 0);
|
|
55
|
+
let PaginationQuery = class PaginationQuery {
|
|
56
|
+
// things about pagination
|
|
57
|
+
offset;
|
|
58
|
+
limit;
|
|
59
|
+
where;
|
|
60
|
+
};
|
|
61
|
+
tslib_1.__decorate([
|
|
62
|
+
(0, schema_1.Minimum)(0),
|
|
63
|
+
(0, schema_1.Default)(0),
|
|
64
|
+
tslib_1.__metadata("design:type", Number)
|
|
65
|
+
], PaginationQuery.prototype, "offset", void 0);
|
|
66
|
+
tslib_1.__decorate([
|
|
67
|
+
(0, schema_1.Minimum)(1),
|
|
68
|
+
(0, schema_1.Maximum)(1000),
|
|
69
|
+
(0, schema_1.Default)(50),
|
|
70
|
+
tslib_1.__metadata("design:type", Number)
|
|
71
|
+
], PaginationQuery.prototype, "limit", void 0);
|
|
72
|
+
tslib_1.__decorate([
|
|
73
|
+
(0, schema_1.Property)("T"),
|
|
74
|
+
tslib_1.__metadata("design:type", Object)
|
|
75
|
+
], PaginationQuery.prototype, "where", void 0);
|
|
76
|
+
PaginationQuery = tslib_1.__decorate([
|
|
77
|
+
(0, schema_1.Generics)("T")
|
|
78
|
+
], PaginationQuery);
|
|
79
|
+
class Param1Type {
|
|
80
|
+
value1;
|
|
81
|
+
}
|
|
82
|
+
tslib_1.__decorate([
|
|
83
|
+
(0, schema_1.Required)(),
|
|
84
|
+
tslib_1.__metadata("design:type", String)
|
|
85
|
+
], Param1Type.prototype, "value1", void 0);
|
|
86
|
+
class Param2Type {
|
|
87
|
+
value2;
|
|
88
|
+
}
|
|
89
|
+
tslib_1.__decorate([
|
|
90
|
+
(0, schema_1.Required)(),
|
|
91
|
+
tslib_1.__metadata("design:type", String)
|
|
92
|
+
], Param2Type.prototype, "value2", void 0);
|
|
93
|
+
let TestBodyParamsCtrl = class TestBodyParamsCtrl {
|
|
94
|
+
testScenario1(contentType, payload) {
|
|
95
|
+
return { payload, contentType };
|
|
96
|
+
}
|
|
97
|
+
testScenario2(value) {
|
|
98
|
+
return { value };
|
|
99
|
+
}
|
|
100
|
+
testScenario3(value) {
|
|
101
|
+
return { value };
|
|
102
|
+
}
|
|
103
|
+
testScenario4(value) {
|
|
104
|
+
return { value };
|
|
105
|
+
}
|
|
106
|
+
testScenario4b(value) {
|
|
107
|
+
return { value };
|
|
108
|
+
}
|
|
109
|
+
testScenario4c(value) {
|
|
110
|
+
return { value };
|
|
111
|
+
}
|
|
112
|
+
testScenario5(raw, payload, context) {
|
|
113
|
+
return { value: raw.toString("utf8") };
|
|
114
|
+
}
|
|
115
|
+
testScenario6(type) {
|
|
116
|
+
return { type };
|
|
117
|
+
}
|
|
118
|
+
testScenario7(value) {
|
|
119
|
+
return { value };
|
|
120
|
+
}
|
|
121
|
+
testScenario8(model) {
|
|
122
|
+
return { model };
|
|
123
|
+
}
|
|
124
|
+
testScenario9(q) {
|
|
125
|
+
return { q };
|
|
126
|
+
}
|
|
127
|
+
testScenario10(param1, param2) {
|
|
128
|
+
return { param1, param2 };
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
tslib_1.__decorate([
|
|
132
|
+
(0, common_1.Post)("/scenario-1"),
|
|
133
|
+
(0, schema_1.Status)(201),
|
|
134
|
+
(0, schema_1.Description)("retrieve body and header content-type"),
|
|
135
|
+
tslib_1.__param(0, (0, common_1.HeaderParams)("Content-type")),
|
|
136
|
+
tslib_1.__param(1, (0, common_1.BodyParams)()),
|
|
137
|
+
tslib_1.__metadata("design:type", Function),
|
|
138
|
+
tslib_1.__metadata("design:paramtypes", [String, Object]),
|
|
139
|
+
tslib_1.__metadata("design:returntype", void 0)
|
|
140
|
+
], TestBodyParamsCtrl.prototype, "testScenario1", null);
|
|
141
|
+
tslib_1.__decorate([
|
|
142
|
+
(0, common_1.Post)("/scenario-2"),
|
|
143
|
+
(0, schema_1.Description)("Extract field from body payload as string[]"),
|
|
144
|
+
tslib_1.__param(0, (0, common_1.BodyParams)("test")),
|
|
145
|
+
tslib_1.__metadata("design:type", Function),
|
|
146
|
+
tslib_1.__metadata("design:paramtypes", [Array]),
|
|
147
|
+
tslib_1.__metadata("design:returntype", Object)
|
|
148
|
+
], TestBodyParamsCtrl.prototype, "testScenario2", null);
|
|
149
|
+
tslib_1.__decorate([
|
|
150
|
+
(0, common_1.Post)("/scenario-3"),
|
|
151
|
+
(0, schema_1.Description)("Extract body payload as string[]"),
|
|
152
|
+
tslib_1.__param(0, (0, common_1.BodyParams)()),
|
|
153
|
+
tslib_1.__metadata("design:type", Function),
|
|
154
|
+
tslib_1.__metadata("design:paramtypes", [Array]),
|
|
155
|
+
tslib_1.__metadata("design:returntype", Object)
|
|
156
|
+
], TestBodyParamsCtrl.prototype, "testScenario3", null);
|
|
157
|
+
tslib_1.__decorate([
|
|
158
|
+
(0, common_1.Post)("/scenario-4"),
|
|
159
|
+
(0, schema_1.Description)("Extract field from body payload as string[] with required annotation"),
|
|
160
|
+
tslib_1.__param(0, (0, schema_1.Required)()),
|
|
161
|
+
tslib_1.__param(0, (0, common_1.BodyParams)("test")),
|
|
162
|
+
tslib_1.__metadata("design:type", Function),
|
|
163
|
+
tslib_1.__metadata("design:paramtypes", [Array]),
|
|
164
|
+
tslib_1.__metadata("design:returntype", Object)
|
|
165
|
+
], TestBodyParamsCtrl.prototype, "testScenario4", null);
|
|
166
|
+
tslib_1.__decorate([
|
|
167
|
+
(0, common_1.Post)("/scenario-4b"),
|
|
168
|
+
(0, schema_1.Description)("Extract field from body payload as string"),
|
|
169
|
+
tslib_1.__param(0, (0, schema_1.Required)()),
|
|
170
|
+
tslib_1.__param(0, (0, common_1.BodyParams)("test")),
|
|
171
|
+
tslib_1.__metadata("design:type", Function),
|
|
172
|
+
tslib_1.__metadata("design:paramtypes", [String]),
|
|
173
|
+
tslib_1.__metadata("design:returntype", Object)
|
|
174
|
+
], TestBodyParamsCtrl.prototype, "testScenario4b", null);
|
|
175
|
+
tslib_1.__decorate([
|
|
176
|
+
(0, common_1.Post)("/scenario-4c"),
|
|
177
|
+
(0, schema_1.Description)("Extract field from body payload as number with required annotation"),
|
|
178
|
+
tslib_1.__param(0, (0, schema_1.Required)()),
|
|
179
|
+
tslib_1.__param(0, (0, common_1.BodyParams)("test")),
|
|
180
|
+
tslib_1.__metadata("design:type", Function),
|
|
181
|
+
tslib_1.__metadata("design:paramtypes", [Number]),
|
|
182
|
+
tslib_1.__metadata("design:returntype", Object)
|
|
183
|
+
], TestBodyParamsCtrl.prototype, "testScenario4c", null);
|
|
184
|
+
tslib_1.__decorate([
|
|
185
|
+
(0, common_1.Post)("/scenario-5"),
|
|
186
|
+
(0, schema_1.Description)("Extract raw body payload as Buffer"),
|
|
187
|
+
tslib_1.__param(0, (0, common_1.RawBodyParams)()),
|
|
188
|
+
tslib_1.__param(1, (0, common_1.BodyParams)()),
|
|
189
|
+
tslib_1.__param(2, (0, common_1.Context)()),
|
|
190
|
+
tslib_1.__metadata("design:type", Function),
|
|
191
|
+
tslib_1.__metadata("design:paramtypes", [Buffer, Object, Object]),
|
|
192
|
+
tslib_1.__metadata("design:returntype", Object)
|
|
193
|
+
], TestBodyParamsCtrl.prototype, "testScenario5", null);
|
|
194
|
+
tslib_1.__decorate([
|
|
195
|
+
(0, common_1.Post)("/scenario-6"),
|
|
196
|
+
tslib_1.__param(0, (0, common_1.BodyParams)("type", String)),
|
|
197
|
+
tslib_1.__metadata("design:type", Function),
|
|
198
|
+
tslib_1.__metadata("design:paramtypes", [Object]),
|
|
199
|
+
tslib_1.__metadata("design:returntype", Object)
|
|
200
|
+
], TestBodyParamsCtrl.prototype, "testScenario6", null);
|
|
201
|
+
tslib_1.__decorate([
|
|
202
|
+
(0, common_1.Post)("/scenario-7"),
|
|
203
|
+
tslib_1.__param(0, (0, common_1.BodyParams)("test")),
|
|
204
|
+
tslib_1.__metadata("design:type", Function),
|
|
205
|
+
tslib_1.__metadata("design:paramtypes", [String]),
|
|
206
|
+
tslib_1.__metadata("design:returntype", Object)
|
|
207
|
+
], TestBodyParamsCtrl.prototype, "testScenario7", null);
|
|
208
|
+
tslib_1.__decorate([
|
|
209
|
+
(0, common_1.Post)("/scenario-8"),
|
|
210
|
+
tslib_1.__param(0, (0, common_1.BodyParams)()),
|
|
211
|
+
tslib_1.__metadata("design:type", Function),
|
|
212
|
+
tslib_1.__metadata("design:paramtypes", [NullModel]),
|
|
213
|
+
tslib_1.__metadata("design:returntype", void 0)
|
|
214
|
+
], TestBodyParamsCtrl.prototype, "testScenario8", null);
|
|
215
|
+
tslib_1.__decorate([
|
|
216
|
+
(0, common_1.Post)("/scenario-9"),
|
|
217
|
+
tslib_1.__param(0, (0, common_1.BodyParams)()),
|
|
218
|
+
tslib_1.__param(0, (0, schema_1.GenericOf)(FindQuery)),
|
|
219
|
+
tslib_1.__metadata("design:type", Function),
|
|
220
|
+
tslib_1.__metadata("design:paramtypes", [PaginationQuery]),
|
|
221
|
+
tslib_1.__metadata("design:returntype", void 0)
|
|
222
|
+
], TestBodyParamsCtrl.prototype, "testScenario9", null);
|
|
223
|
+
tslib_1.__decorate([
|
|
224
|
+
(0, common_1.Post)("/scenario-10"),
|
|
225
|
+
tslib_1.__param(0, (0, schema_1.Required)()),
|
|
226
|
+
tslib_1.__param(0, (0, common_1.BodyParams)("param1", Param1Type)),
|
|
227
|
+
tslib_1.__param(1, (0, schema_1.Required)()),
|
|
228
|
+
tslib_1.__param(1, (0, common_1.BodyParams)("param2", Param2Type)),
|
|
229
|
+
tslib_1.__metadata("design:type", Function),
|
|
230
|
+
tslib_1.__metadata("design:paramtypes", [Param1Type,
|
|
231
|
+
Param2Type]),
|
|
232
|
+
tslib_1.__metadata("design:returntype", void 0)
|
|
233
|
+
], TestBodyParamsCtrl.prototype, "testScenario10", null);
|
|
234
|
+
TestBodyParamsCtrl = tslib_1.__decorate([
|
|
235
|
+
(0, common_1.Controller)("/body-params")
|
|
236
|
+
], TestBodyParamsCtrl);
|
|
237
|
+
function testBodyParams(options) {
|
|
238
|
+
let request;
|
|
239
|
+
beforeAll(common_1.PlatformTest.bootstrap(options.server, {
|
|
240
|
+
...options,
|
|
241
|
+
mount: {
|
|
242
|
+
"/rest": [TestBodyParamsCtrl]
|
|
243
|
+
}
|
|
244
|
+
}));
|
|
245
|
+
beforeAll(() => {
|
|
246
|
+
request = (0, supertest_1.default)(common_1.PlatformTest.callback());
|
|
247
|
+
});
|
|
248
|
+
afterAll(common_1.PlatformTest.reset);
|
|
249
|
+
describe("Scenario 1: POST /rest/body-params/scenario-1", () => {
|
|
250
|
+
it("should return a 201 response", async () => {
|
|
251
|
+
const response = await request
|
|
252
|
+
.post("/rest/body-params/scenario-1")
|
|
253
|
+
.set({
|
|
254
|
+
"Content-Type": "application/json"
|
|
255
|
+
})
|
|
256
|
+
.send({
|
|
257
|
+
id: "id"
|
|
258
|
+
})
|
|
259
|
+
.expect(201);
|
|
260
|
+
expect(response.body).toEqual({
|
|
261
|
+
contentType: "application/json",
|
|
262
|
+
payload: {
|
|
263
|
+
id: "id"
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
});
|
|
267
|
+
});
|
|
268
|
+
describe("Scenario2: with expression Array<string>", () => {
|
|
269
|
+
it("should return value", async () => {
|
|
270
|
+
const response = await request
|
|
271
|
+
.post("/rest/body-params/scenario-2")
|
|
272
|
+
.send({
|
|
273
|
+
test: ["value"]
|
|
274
|
+
})
|
|
275
|
+
.expect(200);
|
|
276
|
+
expect(response.body).toEqual({ value: ["value"] });
|
|
277
|
+
});
|
|
278
|
+
it("should return an empty array (1)", async () => {
|
|
279
|
+
const response = await request.post("/rest/body-params/scenario-2").send().expect(200);
|
|
280
|
+
expect(response.body).toEqual({});
|
|
281
|
+
});
|
|
282
|
+
it("should return an empty value (2)", async () => {
|
|
283
|
+
const response = await request.post("/rest/body-params/scenario-2").send({}).expect(200);
|
|
284
|
+
expect(response.body).toEqual({});
|
|
285
|
+
});
|
|
286
|
+
});
|
|
287
|
+
describe("Scenario3: without expression Array<string>", () => {
|
|
288
|
+
it("should return value", async () => {
|
|
289
|
+
const response = await request.post("/rest/body-params/scenario-3").send(["value"]).expect(200);
|
|
290
|
+
expect(response.body).toEqual({ value: ["value"] });
|
|
291
|
+
});
|
|
292
|
+
it("should return an empty array (1)", async () => {
|
|
293
|
+
const response = await request.post("/rest/body-params/scenario-3").send().expect(200);
|
|
294
|
+
expect(response.body).toEqual({ value: [{}] });
|
|
295
|
+
});
|
|
296
|
+
});
|
|
297
|
+
describe("Scenario4: with expression required Array<string>", () => {
|
|
298
|
+
it("should return value", async () => {
|
|
299
|
+
const response = await request
|
|
300
|
+
.post("/rest/body-params/scenario-4")
|
|
301
|
+
.send({ test: ["value"] })
|
|
302
|
+
.expect(200);
|
|
303
|
+
expect(response.body).toEqual({ value: ["value"] });
|
|
304
|
+
});
|
|
305
|
+
it("should throw an exception", async () => {
|
|
306
|
+
const response = await request.post("/rest/body-params/scenario-4").send().expect(400);
|
|
307
|
+
expect(response.body).toEqual({
|
|
308
|
+
name: "REQUIRED_VALIDATION_ERROR",
|
|
309
|
+
message: "Bad request on parameter \"request.body.test\".\nIt should have required parameter 'test'",
|
|
310
|
+
status: 400,
|
|
311
|
+
errors: [
|
|
312
|
+
{
|
|
313
|
+
dataPath: "",
|
|
314
|
+
keyword: "required",
|
|
315
|
+
message: "It should have required parameter 'test'",
|
|
316
|
+
modelName: "body",
|
|
317
|
+
params: { missingProperty: "test" },
|
|
318
|
+
schemaPath: "#/required"
|
|
319
|
+
}
|
|
320
|
+
]
|
|
321
|
+
});
|
|
322
|
+
});
|
|
323
|
+
});
|
|
324
|
+
describe("Scenario4b: with expression required String", () => {
|
|
325
|
+
it("should return value", async () => {
|
|
326
|
+
const response = await request.post("/rest/body-params/scenario-4b").send({ test: "value" }).expect(200);
|
|
327
|
+
expect(response.body).toEqual({ value: "value" });
|
|
328
|
+
});
|
|
329
|
+
it("should throw an exception when nothing is sent", async () => {
|
|
330
|
+
const response = await request.post("/rest/body-params/scenario-4b").send().expect(400);
|
|
331
|
+
expect(response.body).toEqual({
|
|
332
|
+
name: "REQUIRED_VALIDATION_ERROR",
|
|
333
|
+
message: "Bad request on parameter \"request.body.test\".\nIt should have required parameter 'test'",
|
|
334
|
+
status: 400,
|
|
335
|
+
errors: [
|
|
336
|
+
{
|
|
337
|
+
dataPath: "",
|
|
338
|
+
keyword: "required",
|
|
339
|
+
message: "It should have required parameter 'test'",
|
|
340
|
+
modelName: "body",
|
|
341
|
+
params: { missingProperty: "test" },
|
|
342
|
+
schemaPath: "#/required"
|
|
343
|
+
}
|
|
344
|
+
]
|
|
345
|
+
});
|
|
346
|
+
});
|
|
347
|
+
it("should throw an exception when nothing is an empty string is sent", async () => {
|
|
348
|
+
const response = await request.post("/rest/body-params/scenario-4b").send({ test: "" }).expect(400);
|
|
349
|
+
expect(response.body).toEqual({
|
|
350
|
+
name: "REQUIRED_VALIDATION_ERROR",
|
|
351
|
+
message: "Bad request on parameter \"request.body.test\".\nIt should have required parameter 'test'",
|
|
352
|
+
status: 400,
|
|
353
|
+
errors: [
|
|
354
|
+
{
|
|
355
|
+
dataPath: "",
|
|
356
|
+
keyword: "required",
|
|
357
|
+
message: "It should have required parameter 'test'",
|
|
358
|
+
modelName: "body",
|
|
359
|
+
params: { missingProperty: "test" },
|
|
360
|
+
schemaPath: "#/required"
|
|
361
|
+
}
|
|
362
|
+
]
|
|
363
|
+
});
|
|
364
|
+
});
|
|
365
|
+
});
|
|
366
|
+
describe("Scenario4c: with expression required Number", () => {
|
|
367
|
+
it("should return value (with 1)", async () => {
|
|
368
|
+
const response = await request.post("/rest/body-params/scenario-4c").send({ test: 1 }).expect(200);
|
|
369
|
+
expect(response.body).toEqual({ value: 1 });
|
|
370
|
+
});
|
|
371
|
+
it("should return value (with 0)", async () => {
|
|
372
|
+
const response = await request.post("/rest/body-params/scenario-4c").send({ test: 0 }).expect(200);
|
|
373
|
+
expect(response.body).toEqual({ value: 0 });
|
|
374
|
+
});
|
|
375
|
+
it("should throw an exception when nothing is sent", async () => {
|
|
376
|
+
const response = await request.post("/rest/body-params/scenario-4b").send().expect(400);
|
|
377
|
+
expect(response.body).toEqual({
|
|
378
|
+
name: "REQUIRED_VALIDATION_ERROR",
|
|
379
|
+
message: "Bad request on parameter \"request.body.test\".\nIt should have required parameter 'test'",
|
|
380
|
+
status: 400,
|
|
381
|
+
errors: [
|
|
382
|
+
{
|
|
383
|
+
dataPath: "",
|
|
384
|
+
keyword: "required",
|
|
385
|
+
message: "It should have required parameter 'test'",
|
|
386
|
+
modelName: "body",
|
|
387
|
+
params: { missingProperty: "test" },
|
|
388
|
+
schemaPath: "#/required"
|
|
389
|
+
}
|
|
390
|
+
]
|
|
391
|
+
});
|
|
392
|
+
});
|
|
393
|
+
});
|
|
394
|
+
describe("Scenario5: with raw payload", () => {
|
|
395
|
+
it("should return value", async () => {
|
|
396
|
+
const response = await request.post("/rest/body-params/scenario-5").send('{"test": ["value"]}').expect(200);
|
|
397
|
+
expect(response.body).toEqual({
|
|
398
|
+
value: '{"test": ["value"]}'
|
|
399
|
+
});
|
|
400
|
+
});
|
|
401
|
+
});
|
|
402
|
+
describe("Scenario6: Enum", () => {
|
|
403
|
+
it("should return value", async () => {
|
|
404
|
+
const response = await request.post("/rest/body-params/scenario-6").send({
|
|
405
|
+
type: "TITLE"
|
|
406
|
+
});
|
|
407
|
+
expect(response.body).toEqual({
|
|
408
|
+
type: "TITLE"
|
|
409
|
+
});
|
|
410
|
+
});
|
|
411
|
+
});
|
|
412
|
+
describe("Scenario7: payload with Null", () => {
|
|
413
|
+
it("should return value", async () => {
|
|
414
|
+
const response = await request.post("/rest/body-params/scenario-7").send({
|
|
415
|
+
test: null
|
|
416
|
+
});
|
|
417
|
+
expect(response.body).toEqual({
|
|
418
|
+
value: null
|
|
419
|
+
});
|
|
420
|
+
});
|
|
421
|
+
});
|
|
422
|
+
describe("Scenario8: payload with props to null", () => {
|
|
423
|
+
it("should return value with null value", async () => {
|
|
424
|
+
const response = await request.post("/rest/body-params/scenario-8").send({
|
|
425
|
+
prop1: null,
|
|
426
|
+
prop2: null,
|
|
427
|
+
prop3: null,
|
|
428
|
+
prop4: null
|
|
429
|
+
});
|
|
430
|
+
expect(response.body).toEqual({
|
|
431
|
+
model: {
|
|
432
|
+
prop1: null,
|
|
433
|
+
prop2: null,
|
|
434
|
+
prop3: null,
|
|
435
|
+
prop4: null
|
|
436
|
+
}
|
|
437
|
+
});
|
|
438
|
+
});
|
|
439
|
+
});
|
|
440
|
+
describe("Scenario9: payload with Generics", () => {
|
|
441
|
+
it("should return value", async () => {
|
|
442
|
+
const response = await request
|
|
443
|
+
.post("/rest/body-params/scenario-9")
|
|
444
|
+
.send({
|
|
445
|
+
offset: 0,
|
|
446
|
+
limit: 10,
|
|
447
|
+
where: {
|
|
448
|
+
a: "ca",
|
|
449
|
+
b: "cb"
|
|
450
|
+
}
|
|
451
|
+
})
|
|
452
|
+
.expect(200);
|
|
453
|
+
expect(response.body).toEqual({
|
|
454
|
+
q: {
|
|
455
|
+
limit: 10,
|
|
456
|
+
offset: 0,
|
|
457
|
+
where: {
|
|
458
|
+
a: "ca",
|
|
459
|
+
b: "cb"
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
});
|
|
463
|
+
});
|
|
464
|
+
it("should throw a bad request", async () => {
|
|
465
|
+
const response = await request
|
|
466
|
+
.post("/rest/body-params/scenario-9")
|
|
467
|
+
.send({
|
|
468
|
+
offset: 0,
|
|
469
|
+
limit: 0,
|
|
470
|
+
where: {
|
|
471
|
+
a: "ca",
|
|
472
|
+
b: "cb"
|
|
473
|
+
}
|
|
474
|
+
})
|
|
475
|
+
.expect(400);
|
|
476
|
+
expect(response.body).toEqual({
|
|
477
|
+
errors: [
|
|
478
|
+
{
|
|
479
|
+
data: 0,
|
|
480
|
+
dataPath: ".limit",
|
|
481
|
+
instancePath: "/limit",
|
|
482
|
+
keyword: "minimum",
|
|
483
|
+
message: "must be >= 1",
|
|
484
|
+
modelName: "PaginationQuery",
|
|
485
|
+
params: {
|
|
486
|
+
comparison: ">=",
|
|
487
|
+
limit: 1
|
|
488
|
+
},
|
|
489
|
+
schemaPath: "#/properties/limit/minimum"
|
|
490
|
+
}
|
|
491
|
+
],
|
|
492
|
+
message: 'Bad request on parameter "request.body".\nPaginationQuery.limit must be >= 1. Given value: 0',
|
|
493
|
+
name: "AJV_VALIDATION_ERROR",
|
|
494
|
+
status: 400
|
|
495
|
+
});
|
|
496
|
+
});
|
|
497
|
+
});
|
|
498
|
+
describe("Scenario10: validate two payload", () => {
|
|
499
|
+
it("should throw a Bad request if body params is missing (1)", async () => {
|
|
500
|
+
await request
|
|
501
|
+
.post("/rest/body-params/scenario-10")
|
|
502
|
+
.send({ param1: {}, param2: { value2: "value" } })
|
|
503
|
+
.expect(400);
|
|
504
|
+
});
|
|
505
|
+
it("should throw a Bad request if body params is missing (2)", async () => {
|
|
506
|
+
await request.post("/rest/body-params/scenario-10").send({ param1: {}, param2: {} }).expect(400);
|
|
507
|
+
});
|
|
508
|
+
it("should throw a Bad request if body params is missing (3)", async () => {
|
|
509
|
+
await request
|
|
510
|
+
.post("/rest/body-params/scenario-10")
|
|
511
|
+
.send({ param1: { value: "value" }, param2: {} })
|
|
512
|
+
.expect(400);
|
|
513
|
+
});
|
|
514
|
+
it("should throw a Bad request if body params is missing (4)", async () => {
|
|
515
|
+
await request.post("/rest/body-params/scenario-10").send({}).expect(400);
|
|
516
|
+
});
|
|
517
|
+
it("should validate the body params", async () => {
|
|
518
|
+
await request
|
|
519
|
+
.post("/rest/body-params/scenario-10")
|
|
520
|
+
.send({ param1: { value1: "value" }, param2: { value2: "value" } })
|
|
521
|
+
.expect(200);
|
|
522
|
+
});
|
|
523
|
+
});
|
|
524
|
+
}
|
|
525
|
+
exports.testBodyParams = testBodyParams;
|
|
526
|
+
//# sourceMappingURL=testBodyParams.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testBodyParams.js","sourceRoot":"","sources":["../../../src/tests/testBodyParams.ts"],"names":[],"mappings":";;;;AAAA,qBAAmB;AACnB,yCAA8G;AAC9G,yCAA+H;AAC/H,kEAAkC;AAGlC,IAAK,MAGJ;AAHD,WAAK,MAAM;IACT,qCAAK,CAAA;IACL,iCAAG,CAAA;AACL,CAAC,EAHI,MAAM,KAAN,MAAM,QAGV;AAED,MAAM,WAAW;IAEf,EAAE,CAAS;CACZ;AADC;IADC,IAAA,iBAAQ,GAAE;;uCACA;AAGb,MAAM,SAAS;IAEb,KAAK,CAAS;IAGd,KAAK,CAAS;IAGd,KAAK,CAAO;IAGZ,KAAK,CAAc;CACpB;AAVC;IADC,IAAA,iBAAQ,GAAE;;wCACG;AAGd;IADC,IAAA,iBAAQ,GAAE;;wCACG;AAGd;IADC,IAAA,iBAAQ,GAAE;sCACJ,IAAI;wCAAC;AAGZ;IADC,IAAA,iBAAQ,EAAC,WAAW,CAAC;sCACf,WAAW;wCAAC;AAGrB,MAAM,SAAS;IAEb,CAAC,CAAU;IAGX,CAAC,CAAU;CACZ;AAJC;IADC,IAAA,iBAAQ,GAAE;;oCACA;AAGX;IADC,IAAA,iBAAQ,GAAE;;oCACA;AAIb,IAAM,eAAe,GAArB,MAAM,eAAe;IACnB,0BAA0B;IAG1B,MAAM,CAAU;IAKhB,KAAK,CAAU;IAGf,KAAK,CAAK;CACX,CAAA;AATC;IAFC,IAAA,gBAAO,EAAC,CAAC,CAAC;IACV,IAAA,gBAAO,EAAC,CAAC,CAAC;;+CACK;AAKhB;IAHC,IAAA,gBAAO,EAAC,CAAC,CAAC;IACV,IAAA,gBAAO,EAAC,IAAI,CAAC;IACb,IAAA,gBAAO,EAAC,EAAE,CAAC;;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AC,EAAC,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACjG,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,0DAA0D,EAAE,KAAK,IAAI,EAAE;YACxE,MAAM,OAAO;iBACV,IAAI,CAAC,+BAA+B,CAAC;iBACrC,IAAI,CAAC,EAAC,MAAM,EAAE,EAAC,KAAK,EAAE,OAAO,EAAC,EAAE,MAAM,EAAE,EAAE,EAAC,CAAC;iBAC5C,MAAM,CAAC,GAAG,CAAC,CAAC;QACjB,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,0DAA0D,EAAE,KAAK,IAAI,EAAE;YACxE,MAAM,OAAO,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC3E,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,iCAAiC,EAAE,KAAK,IAAI,EAAE;YAC/C,MAAM,OAAO;iBACV,IAAI,CAAC,+BAA+B,CAAC;iBACrC,IAAI,CAAC,EAAC,MAAM,EAAE,EAAC,MAAM,EAAE,OAAO,EAAC,EAAE,MAAM,EAAE,EAAC,MAAM,EAAE,OAAO,EAAC,EAAC,CAAC;iBAC5D,MAAM,CAAC,GAAG,CAAC,CAAC;QACjB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AA5TD,wCA4TC","sourcesContent":["import \"@tsed/ajv\";\nimport {BodyParams, Context, Controller, HeaderParams, PlatformTest, Post, RawBodyParams} from \"@tsed/common\";\nimport {Default, Description, GenericOf, Generics, Maximum, Minimum, Nullable, Property, Required, Status} from \"@tsed/schema\";\nimport SuperTest from \"supertest\";\nimport {PlatformTestingSdkOpts} from \"../interfaces\";\n\nenum MyEnum {\n TITLE,\n AGE\n}\n\nclass NestedModel {\n @Property()\n id: string;\n}\n\nclass NullModel {\n @Property()\n prop1: string;\n\n @Property()\n prop2: number;\n\n @Property()\n prop3: Date;\n\n @Nullable(NestedModel)\n prop4: NestedModel;\n}\n\nclass FindQuery {\n @Property()\n a?: string;\n\n @Property()\n b?: string;\n}\n\n@Generics(\"T\")\nclass PaginationQuery<T> {\n // things about pagination\n @Minimum(0)\n @Default(0)\n offset?: number;\n\n @Minimum(1)\n @Maximum(1000)\n @Default(50)\n limit?: number;\n\n @Property(\"T\")\n where?: T;\n}\n\nclass Param1Type {\n @Required()\n value1!: string;\n}\n\nclass Param2Type {\n @Required()\n value2!: string;\n}\n\n@Controller(\"/body-params\")\nclass TestBodyParamsCtrl {\n @Post(\"/scenario-1\")\n @Status(201)\n @Description(\"retrieve body and header content-type\")\n testScenario1(@HeaderParams(\"Content-type\") contentType: string, @BodyParams() payload: any) {\n return {payload, contentType};\n }\n\n @Post(\"/scenario-2\")\n @Description(\"Extract field from body payload as string[]\")\n testScenario2(@BodyParams(\"test\") value: string[]): any {\n return {value};\n }\n\n @Post(\"/scenario-3\")\n @Description(\"Extract body payload as string[]\")\n testScenario3(@BodyParams() value: string[]): any {\n return {value};\n }\n\n @Post(\"/scenario-4\")\n @Description(\"Extract field from body payload as string[] with required annotation\")\n testScenario4(@Required() @BodyParams(\"test\") value: string[]): any {\n return {value};\n }\n\n @Post(\"/scenario-4b\")\n @Description(\"Extract field from body payload as string\")\n testScenario4b(@Required() @BodyParams(\"test\") value: string): any {\n return {value};\n }\n\n @Post(\"/scenario-4c\")\n @Description(\"Extract field from body payload as number with required annotation\")\n testScenario4c(@Required() @BodyParams(\"test\") value: number): any {\n return {value};\n }\n\n @Post(\"/scenario-5\")\n @Description(\"Extract raw body payload as Buffer\")\n testScenario5(@RawBodyParams() raw: Buffer, @BodyParams() payload: any, @Context() context: Context): any {\n return {value: raw.toString(\"utf8\")};\n }\n\n @Post(\"/scenario-6\")\n testScenario6(@BodyParams(\"type\", String) type: keyof typeof MyEnum): any {\n return {type};\n }\n\n @Post(\"/scenario-7\")\n testScenario7(@BodyParams(\"test\") value: string): any {\n return {value};\n }\n\n @Post(\"/scenario-8\")\n testScenario8(@BodyParams() model: NullModel) {\n return {model};\n }\n\n @Post(\"/scenario-9\")\n testScenario9(@BodyParams() @GenericOf(FindQuery) q: PaginationQuery<FindQuery>) {\n return {q};\n }\n\n @Post(\"/scenario-10\")\n testScenario10(\n @Required() @BodyParams(\"param1\", Param1Type) param1: Param1Type,\n @Required() @BodyParams(\"param2\", Param2Type) param2: Param2Type\n ) {\n return {param1, param2};\n }\n}\n\nexport function testBodyParams(options: PlatformTestingSdkOpts) {\n let request: SuperTest.SuperTest<SuperTest.Test>;\n\n beforeAll(\n PlatformTest.bootstrap(options.server, {\n ...options,\n mount: {\n \"/rest\": [TestBodyParamsCtrl]\n }\n })\n );\n beforeAll(() => {\n request = SuperTest(PlatformTest.callback());\n });\n afterAll(PlatformTest.reset);\n\n describe(\"Scenario 1: POST /rest/body-params/scenario-1\", () => {\n it(\"should return a 201 response\", async () => {\n const response = await request\n .post(\"/rest/body-params/scenario-1\")\n .set({\n \"Content-Type\": \"application/json\"\n })\n .send({\n id: \"id\"\n })\n .expect(201);\n\n expect(response.body).toEqual({\n contentType: \"application/json\",\n payload: {\n id: \"id\"\n }\n });\n });\n });\n describe(\"Scenario2: with expression Array<string>\", () => {\n it(\"should return value\", async () => {\n const response = await request\n .post(\"/rest/body-params/scenario-2\")\n .send({\n test: [\"value\"]\n })\n .expect(200);\n\n expect(response.body).toEqual({value: [\"value\"]});\n });\n it(\"should return an empty array (1)\", async () => {\n const response = await request.post(\"/rest/body-params/scenario-2\").send().expect(200);\n\n expect(response.body).toEqual({});\n });\n it(\"should return an empty value (2)\", async () => {\n const response = await request.post(\"/rest/body-params/scenario-2\").send({}).expect(200);\n\n expect(response.body).toEqual({});\n });\n });\n describe(\"Scenario3: without expression Array<string>\", () => {\n it(\"should return value\", async () => {\n const response = await request.post(\"/rest/body-params/scenario-3\").send([\"value\"]).expect(200);\n\n expect(response.body).toEqual({value: [\"value\"]});\n });\n it(\"should return an empty array (1)\", async () => {\n const response = await request.post(\"/rest/body-params/scenario-3\").send().expect(200);\n\n expect(response.body).toEqual({value: [{}]});\n });\n });\n describe(\"Scenario4: with expression required Array<string>\", () => {\n it(\"should return value\", async () => {\n const response = await request\n .post(\"/rest/body-params/scenario-4\")\n .send({test: [\"value\"]})\n .expect(200);\n\n expect(response.body).toEqual({value: [\"value\"]});\n });\n it(\"should throw an exception\", async () => {\n const response = await request.post(\"/rest/body-params/scenario-4\").send().expect(400);\n\n expect(response.body).toEqual({\n name: \"REQUIRED_VALIDATION_ERROR\",\n message: \"Bad request on parameter \\\"request.body.test\\\".\\nIt should have required parameter 'test'\",\n status: 400,\n errors: [\n {\n dataPath: \"\",\n keyword: \"required\",\n message: \"It should have required parameter 'test'\",\n modelName: \"body\",\n params: {missingProperty: \"test\"},\n schemaPath: \"#/required\"\n }\n ]\n });\n });\n });\n\n describe(\"Scenario4b: with expression required String\", () => {\n it(\"should return value\", async () => {\n const response = await request.post(\"/rest/body-params/scenario-4b\").send({test: \"value\"}).expect(200);\n\n expect(response.body).toEqual({value: \"value\"});\n });\n it(\"should throw an exception when nothing is sent\", async () => {\n const response = await request.post(\"/rest/body-params/scenario-4b\").send().expect(400);\n\n expect(response.body).toEqual({\n name: \"REQUIRED_VALIDATION_ERROR\",\n message: \"Bad request on parameter \\\"request.body.test\\\".\\nIt should have required parameter 'test'\",\n status: 400,\n errors: [\n {\n dataPath: \"\",\n keyword: \"required\",\n message: \"It should have required parameter 'test'\",\n modelName: \"body\",\n params: {missingProperty: \"test\"},\n schemaPath: \"#/required\"\n }\n ]\n });\n });\n it(\"should throw an exception when nothing is an empty string is sent\", async () => {\n const response = await request.post(\"/rest/body-params/scenario-4b\").send({test: \"\"}).expect(400);\n\n expect(response.body).toEqual({\n name: \"REQUIRED_VALIDATION_ERROR\",\n message: \"Bad request on parameter \\\"request.body.test\\\".\\nIt should have required parameter 'test'\",\n status: 400,\n errors: [\n {\n dataPath: \"\",\n keyword: \"required\",\n message: \"It should have required parameter 'test'\",\n modelName: \"body\",\n params: {missingProperty: \"test\"},\n schemaPath: \"#/required\"\n }\n ]\n });\n });\n });\n describe(\"Scenario4c: with expression required Number\", () => {\n it(\"should return value (with 1)\", async () => {\n const response = await request.post(\"/rest/body-params/scenario-4c\").send({test: 1}).expect(200);\n\n expect(response.body).toEqual({value: 1});\n });\n it(\"should return value (with 0)\", async () => {\n const response = await request.post(\"/rest/body-params/scenario-4c\").send({test: 0}).expect(200);\n\n expect(response.body).toEqual({value: 0});\n });\n it(\"should throw an exception when nothing is sent\", async () => {\n const response = await request.post(\"/rest/body-params/scenario-4b\").send().expect(400);\n\n expect(response.body).toEqual({\n name: \"REQUIRED_VALIDATION_ERROR\",\n message: \"Bad request on parameter \\\"request.body.test\\\".\\nIt should have required parameter 'test'\",\n status: 400,\n errors: [\n {\n dataPath: \"\",\n keyword: \"required\",\n message: \"It should have required parameter 'test'\",\n modelName: \"body\",\n params: {missingProperty: \"test\"},\n schemaPath: \"#/required\"\n }\n ]\n });\n });\n });\n describe(\"Scenario5: with raw payload\", () => {\n it(\"should return value\", async () => {\n const response = await request.post(\"/rest/body-params/scenario-5\").send('{\"test\": [\"value\"]}').expect(200);\n\n expect(response.body).toEqual({\n value: '{\"test\": [\"value\"]}'\n });\n });\n });\n\n describe(\"Scenario6: Enum\", () => {\n it(\"should return value\", async () => {\n const response = await request.post(\"/rest/body-params/scenario-6\").send({\n type: \"TITLE\"\n });\n\n expect(response.body).toEqual({\n type: \"TITLE\"\n });\n });\n });\n\n describe(\"Scenario7: payload with Null\", () => {\n it(\"should return value\", async () => {\n const response = await request.post(\"/rest/body-params/scenario-7\").send({\n test: null\n });\n\n expect(response.body).toEqual({\n value: null\n });\n });\n });\n\n describe(\"Scenario8: payload with props to null\", () => {\n it(\"should return value with null value\", async () => {\n const response = await request.post(\"/rest/body-params/scenario-8\").send({\n prop1: null,\n prop2: null,\n prop3: null,\n prop4: null\n });\n\n expect(response.body).toEqual({\n model: {\n prop1: null,\n prop2: null,\n prop3: null,\n prop4: null\n }\n });\n });\n });\n\n describe(\"Scenario9: payload with Generics\", () => {\n it(\"should return value\", async () => {\n const response = await request\n .post(\"/rest/body-params/scenario-9\")\n .send({\n offset: 0,\n limit: 10,\n where: {\n a: \"ca\",\n b: \"cb\"\n }\n })\n .expect(200);\n\n expect(response.body).toEqual({\n q: {\n limit: 10,\n offset: 0,\n where: {\n a: \"ca\",\n b: \"cb\"\n }\n }\n });\n });\n it(\"should throw a bad request\", async () => {\n const response = await request\n .post(\"/rest/body-params/scenario-9\")\n .send({\n offset: 0,\n limit: 0,\n where: {\n a: \"ca\",\n b: \"cb\"\n }\n })\n .expect(400);\n\n expect(response.body).toEqual({\n errors: [\n {\n data: 0,\n dataPath: \".limit\",\n instancePath: \"/limit\",\n keyword: \"minimum\",\n message: \"must be >= 1\",\n modelName: \"PaginationQuery\",\n params: {\n comparison: \">=\",\n limit: 1\n },\n schemaPath: \"#/properties/limit/minimum\"\n }\n ],\n message: 'Bad request on parameter \"request.body\".\\nPaginationQuery.limit must be >= 1. Given value: 0',\n name: \"AJV_VALIDATION_ERROR\",\n status: 400\n });\n });\n });\n describe(\"Scenario10: validate two payload\", () => {\n it(\"should throw a Bad request if body params is missing (1)\", async () => {\n await request\n .post(\"/rest/body-params/scenario-10\")\n .send({param1: {}, param2: {value2: \"value\"}})\n .expect(400);\n });\n it(\"should throw a Bad request if body params is missing (2)\", async () => {\n await request.post(\"/rest/body-params/scenario-10\").send({param1: {}, param2: {}}).expect(400);\n });\n it(\"should throw a Bad request if body params is missing (3)\", async () => {\n await request\n .post(\"/rest/body-params/scenario-10\")\n .send({param1: {value: \"value\"}, param2: {}})\n .expect(400);\n });\n it(\"should throw a Bad request if body params is missing (4)\", async () => {\n await request.post(\"/rest/body-params/scenario-10\").send({}).expect(400);\n });\n it(\"should validate the body params\", async () => {\n await request\n .post(\"/rest/body-params/scenario-10\")\n .send({param1: {value1: \"value\"}, param2: {value2: \"value\"}})\n .expect(200);\n });\n });\n}\n"]}
|