@tsed/platform-test-sdk 8.19.4 → 8.20.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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate, __metadata, __param } from "tslib";
|
|
2
2
|
import { Controller } from "@tsed/di";
|
|
3
3
|
import { PlatformTest } from "@tsed/platform-http/testing";
|
|
4
|
-
import { CookiesParams } from "@tsed/platform-params";
|
|
4
|
+
import { Context, CookiesParams } from "@tsed/platform-params";
|
|
5
5
|
import { Get } from "@tsed/schema";
|
|
6
6
|
import SuperTest from "supertest";
|
|
7
7
|
import { afterAll, beforeAll, expect, it } from "vitest";
|
|
@@ -13,6 +13,14 @@ let CookiesCtrl = class CookiesCtrl {
|
|
|
13
13
|
scenario1(authorization) {
|
|
14
14
|
return { authorization };
|
|
15
15
|
}
|
|
16
|
+
scenario2($ctx) {
|
|
17
|
+
$ctx.response.cookie("test", "test", {
|
|
18
|
+
path: "/",
|
|
19
|
+
sameSite: true
|
|
20
|
+
});
|
|
21
|
+
$ctx.response.setHeader("test", "test");
|
|
22
|
+
return "OK";
|
|
23
|
+
}
|
|
16
24
|
};
|
|
17
25
|
__decorate([
|
|
18
26
|
Get("/scenario-1"),
|
|
@@ -21,6 +29,13 @@ __decorate([
|
|
|
21
29
|
__metadata("design:paramtypes", [String]),
|
|
22
30
|
__metadata("design:returntype", void 0)
|
|
23
31
|
], CookiesCtrl.prototype, "scenario1", null);
|
|
32
|
+
__decorate([
|
|
33
|
+
Get("/scenario-2"),
|
|
34
|
+
__param(0, Context()),
|
|
35
|
+
__metadata("design:type", Function),
|
|
36
|
+
__metadata("design:paramtypes", [Object]),
|
|
37
|
+
__metadata("design:returntype", void 0)
|
|
38
|
+
], CookiesCtrl.prototype, "scenario2", null);
|
|
24
39
|
CookiesCtrl = __decorate([
|
|
25
40
|
Controller("/cookies")
|
|
26
41
|
], CookiesCtrl);
|
|
@@ -41,4 +56,8 @@ export function testCookies(options) {
|
|
|
41
56
|
const { body } = await request.get("/rest/cookies/scenario-1").set("Cookie", "authorization=eOIjdkk").expect(200);
|
|
42
57
|
expect(body.authorization).toEqual("eOIjdkk");
|
|
43
58
|
});
|
|
59
|
+
it("Scenario 2: GET /rest/cookies/scenario-2", async () => {
|
|
60
|
+
const { headers } = await request.get("/rest/cookies/scenario-2").expect(200);
|
|
61
|
+
expect(headers["set-cookie"][0]).toContain("test=test;");
|
|
62
|
+
});
|
|
44
63
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Context } from "@tsed/platform-params";
|
|
1
2
|
import { PlatformTestingSdkOpts } from "../interfaces/index.js";
|
|
2
3
|
export declare class CookiesCtrl {
|
|
3
4
|
/**
|
|
@@ -7,5 +8,6 @@ export declare class CookiesCtrl {
|
|
|
7
8
|
scenario1(authorization: string): {
|
|
8
9
|
authorization: string;
|
|
9
10
|
};
|
|
11
|
+
scenario2($ctx: Context): string;
|
|
10
12
|
}
|
|
11
13
|
export declare function testCookies(options: PlatformTestingSdkOpts): void;
|
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.
|
|
5
|
+
"version": "8.20.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.
|
|
32
|
-
"@tsed/core": "8.
|
|
33
|
-
"@tsed/di": "8.
|
|
34
|
-
"@tsed/json-mapper": "8.
|
|
31
|
+
"@tsed/ajv": "8.20.0",
|
|
32
|
+
"@tsed/core": "8.20.0",
|
|
33
|
+
"@tsed/di": "8.20.0",
|
|
34
|
+
"@tsed/json-mapper": "8.20.0",
|
|
35
35
|
"@tsed/logger": "8.0.0",
|
|
36
|
-
"@tsed/platform-cache": "8.
|
|
37
|
-
"@tsed/platform-http": "8.
|
|
38
|
-
"@tsed/platform-params": "8.
|
|
39
|
-
"@tsed/platform-router": "8.
|
|
40
|
-
"@tsed/platform-views": "8.
|
|
41
|
-
"@tsed/schema": "8.
|
|
42
|
-
"@tsed/swagger": "8.
|
|
36
|
+
"@tsed/platform-cache": "8.20.0",
|
|
37
|
+
"@tsed/platform-http": "8.20.0",
|
|
38
|
+
"@tsed/platform-params": "8.20.0",
|
|
39
|
+
"@tsed/platform-router": "8.20.0",
|
|
40
|
+
"@tsed/platform-views": "8.20.0",
|
|
41
|
+
"@tsed/schema": "8.20.0",
|
|
42
|
+
"@tsed/swagger": "8.20.0",
|
|
43
43
|
"ajv": "^8.17.1",
|
|
44
44
|
"axios": "1.12.0",
|
|
45
45
|
"read-pkg-up": "7.0.1"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@tsed/barrels": "8.
|
|
49
|
-
"@tsed/typescript": "8.
|
|
48
|
+
"@tsed/barrels": "8.20.0",
|
|
49
|
+
"@tsed/typescript": "8.20.0",
|
|
50
50
|
"eslint": "9.12.0",
|
|
51
51
|
"typescript": "5.9.3"
|
|
52
52
|
},
|