@tsed/platform-test-sdk 8.16.0-rc.4 → 8.16.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/esm/tests/testDeepQueryParams.js +30 -5
- package/package.json +15 -18
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { __decorate, __metadata, __param } from "tslib";
|
|
2
2
|
import "@tsed/ajv";
|
|
3
3
|
import { Controller } from "@tsed/di";
|
|
4
|
+
import { PlatformContext } from "@tsed/platform-http";
|
|
4
5
|
import { PlatformTest } from "@tsed/platform-http/testing";
|
|
5
|
-
import { QueryParams } from "@tsed/platform-params";
|
|
6
|
+
import { Context, QueryParams } from "@tsed/platform-params";
|
|
6
7
|
import { Default, GenericOf, Generics, Get, Maximum, Minimum, Property } from "@tsed/schema";
|
|
7
8
|
import SuperTest from "supertest";
|
|
8
9
|
import { afterAll, beforeAll, describe, expect, it } from "vitest";
|
|
@@ -37,12 +38,15 @@ PaginationQuery = __decorate([
|
|
|
37
38
|
Generics("T")
|
|
38
39
|
], PaginationQuery);
|
|
39
40
|
let TestDeepQueryParamsCtrl = class TestDeepQueryParamsCtrl {
|
|
40
|
-
|
|
41
|
+
testScenario1(q, qs) {
|
|
41
42
|
return { q };
|
|
42
43
|
}
|
|
43
|
-
|
|
44
|
+
testScenario2(q) {
|
|
44
45
|
return { q };
|
|
45
46
|
}
|
|
47
|
+
testScenario3($ctx) {
|
|
48
|
+
return $ctx.request.query;
|
|
49
|
+
}
|
|
46
50
|
};
|
|
47
51
|
__decorate([
|
|
48
52
|
Get("/scenario-1"),
|
|
@@ -52,7 +56,7 @@ __decorate([
|
|
|
52
56
|
__metadata("design:type", Function),
|
|
53
57
|
__metadata("design:paramtypes", [PaginationQuery, Object]),
|
|
54
58
|
__metadata("design:returntype", void 0)
|
|
55
|
-
], TestDeepQueryParamsCtrl.prototype, "
|
|
59
|
+
], TestDeepQueryParamsCtrl.prototype, "testScenario1", null);
|
|
56
60
|
__decorate([
|
|
57
61
|
Get("/scenario-2"),
|
|
58
62
|
__param(0, QueryParams("q")),
|
|
@@ -60,7 +64,14 @@ __decorate([
|
|
|
60
64
|
__metadata("design:type", Function),
|
|
61
65
|
__metadata("design:paramtypes", [PaginationQuery]),
|
|
62
66
|
__metadata("design:returntype", void 0)
|
|
63
|
-
], TestDeepQueryParamsCtrl.prototype, "
|
|
67
|
+
], TestDeepQueryParamsCtrl.prototype, "testScenario2", null);
|
|
68
|
+
__decorate([
|
|
69
|
+
Get("/scenario-3"),
|
|
70
|
+
__param(0, Context()),
|
|
71
|
+
__metadata("design:type", Function),
|
|
72
|
+
__metadata("design:paramtypes", [PlatformContext]),
|
|
73
|
+
__metadata("design:returntype", Object)
|
|
74
|
+
], TestDeepQueryParamsCtrl.prototype, "testScenario3", null);
|
|
64
75
|
TestDeepQueryParamsCtrl = __decorate([
|
|
65
76
|
Controller("/deep-query-params")
|
|
66
77
|
], TestDeepQueryParamsCtrl);
|
|
@@ -134,4 +145,18 @@ export function testDeepQueryParams(options) {
|
|
|
134
145
|
});
|
|
135
146
|
});
|
|
136
147
|
});
|
|
148
|
+
describe("Scenario3", () => {
|
|
149
|
+
it("should return the query params as object", async () => {
|
|
150
|
+
const endpoint = "/rest/deep-query-params/scenario-3";
|
|
151
|
+
const response = await request.get(`${endpoint}?offset=0&limit=10&where[a]=0&where[b]=1`).expect(200);
|
|
152
|
+
expect(response.body).toEqual({
|
|
153
|
+
offset: "0",
|
|
154
|
+
limit: "10",
|
|
155
|
+
where: {
|
|
156
|
+
a: "0",
|
|
157
|
+
b: "1"
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
});
|
|
137
162
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@tsed/platform-test-sdk",
|
|
3
3
|
"description": "Package to test platform adapter integration with Ts.ED",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "8.16.0
|
|
5
|
+
"version": "8.16.0",
|
|
6
6
|
"source": "./src/index.ts",
|
|
7
7
|
"main": "./lib/esm/index.js",
|
|
8
8
|
"module": "./lib/esm/index.js",
|
|
@@ -28,25 +28,25 @@
|
|
|
28
28
|
"Adapter"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@tsed/ajv": "8.16.0
|
|
32
|
-
"@tsed/core": "8.16.0
|
|
33
|
-
"@tsed/di": "8.16.0
|
|
34
|
-
"@tsed/json-mapper": "8.16.0
|
|
31
|
+
"@tsed/ajv": "8.16.0",
|
|
32
|
+
"@tsed/core": "8.16.0",
|
|
33
|
+
"@tsed/di": "8.16.0",
|
|
34
|
+
"@tsed/json-mapper": "8.16.0",
|
|
35
35
|
"@tsed/logger": "8.0.0",
|
|
36
|
-
"@tsed/platform-cache": "8.16.0
|
|
37
|
-
"@tsed/platform-http": "8.16.0
|
|
38
|
-
"@tsed/platform-params": "8.16.0
|
|
39
|
-
"@tsed/platform-router": "8.16.0
|
|
40
|
-
"@tsed/platform-views": "8.16.0
|
|
41
|
-
"@tsed/schema": "8.16.0
|
|
42
|
-
"@tsed/swagger": "8.16.0
|
|
36
|
+
"@tsed/platform-cache": "8.16.0",
|
|
37
|
+
"@tsed/platform-http": "8.16.0",
|
|
38
|
+
"@tsed/platform-params": "8.16.0",
|
|
39
|
+
"@tsed/platform-router": "8.16.0",
|
|
40
|
+
"@tsed/platform-views": "8.16.0",
|
|
41
|
+
"@tsed/schema": "8.16.0",
|
|
42
|
+
"@tsed/swagger": "8.16.0",
|
|
43
43
|
"ajv": "^8.17.1",
|
|
44
44
|
"axios": "1.7.7",
|
|
45
45
|
"read-pkg-up": "7.0.1"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@tsed/barrels": "8.16.0
|
|
49
|
-
"@tsed/typescript": "8.16.0
|
|
48
|
+
"@tsed/barrels": "8.16.0",
|
|
49
|
+
"@tsed/typescript": "8.16.0",
|
|
50
50
|
"eslint": "9.12.0",
|
|
51
51
|
"typescript": "5.4.5"
|
|
52
52
|
},
|
|
@@ -57,8 +57,5 @@
|
|
|
57
57
|
},
|
|
58
58
|
"homepage": "https://github.com/tsedio/tsed/tree/production/packages/platform/platform-test-sdk",
|
|
59
59
|
"author": "Romain Lenzotti",
|
|
60
|
-
"license": "MIT"
|
|
61
|
-
"publishConfig": {
|
|
62
|
-
"tag": "rc"
|
|
63
|
-
}
|
|
60
|
+
"license": "MIT"
|
|
64
61
|
}
|