@tsed/platform-test-sdk 7.18.3-rc.1 → 7.18.3
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/.eslintignore +13 -0
- package/.eslintrc.js +1 -0
- package/lib/cjs/components/PlatformTestSdk.js.map +1 -1
- package/lib/cjs/data/response.data.json +3 -0
- package/lib/cjs/errors/CustomBadRequest.js.map +1 -1
- package/lib/cjs/errors/CustomInternalError.js.map +1 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/interfaces/PlatformTestingSdkOpts.js.map +1 -1
- package/lib/cjs/interfaces/index.js.map +1 -1
- package/lib/cjs/modules/feature/FeatureModule.js.map +1 -1
- package/lib/cjs/modules/feature/controllers/FeatureController.js.map +1 -1
- package/lib/cjs/tests/exports.js.map +1 -1
- package/lib/cjs/tests/testAcceptMime.js.map +1 -1
- package/lib/cjs/tests/testAuth.js.map +1 -1
- package/lib/cjs/tests/testBodyParams.js +12 -12
- package/lib/cjs/tests/testBodyParams.js.map +1 -1
- package/lib/cjs/tests/testCache.js.map +1 -1
- package/lib/cjs/tests/testChildrenControllers.js.map +1 -1
- package/lib/cjs/tests/testCookies.js.map +1 -1
- package/lib/cjs/tests/testCtrlInheritance.js.map +1 -1
- package/lib/cjs/tests/testCustom404.js.map +1 -1
- package/lib/cjs/tests/testErrors.js.map +1 -1
- package/lib/cjs/tests/testHandlers.js.map +1 -1
- package/lib/cjs/tests/testHeaderParams.js.map +1 -1
- package/lib/cjs/tests/testHeaders.js.map +1 -1
- package/lib/cjs/tests/testInheritanceController.js.map +1 -1
- package/lib/cjs/tests/testLocals.js.map +1 -1
- package/lib/cjs/tests/testLocation.js.map +1 -1
- package/lib/cjs/tests/testMiddlewares.js.map +1 -1
- package/lib/cjs/tests/testModule.js.map +1 -1
- package/lib/cjs/tests/testMulter.js +13 -6
- package/lib/cjs/tests/testMulter.js.map +1 -1
- package/lib/cjs/tests/testPathParams.js.map +1 -1
- package/lib/cjs/tests/testQueryParams.js.map +1 -1
- package/lib/cjs/tests/testRedirect.js.map +1 -1
- package/lib/cjs/tests/testResponse.js.map +1 -1
- package/lib/cjs/tests/testResponseFilter.js.map +1 -1
- package/lib/cjs/tests/testRouting.js.map +1 -1
- package/lib/cjs/tests/testScopeRequest.js.map +1 -1
- package/lib/cjs/tests/testSession.js.map +1 -1
- package/lib/cjs/tests/testStatics.js.map +1 -1
- package/lib/cjs/tests/testView.js.map +1 -1
- package/lib/esm/components/PlatformTestSdk.js.map +1 -1
- package/lib/esm/data/response.data.json +3 -0
- package/lib/esm/errors/CustomBadRequest.js.map +1 -1
- package/lib/esm/errors/CustomInternalError.js.map +1 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/interfaces/PlatformTestingSdkOpts.js.map +1 -1
- package/lib/esm/interfaces/index.js.map +1 -1
- package/lib/esm/modules/feature/FeatureModule.js.map +1 -1
- package/lib/esm/modules/feature/controllers/FeatureController.js.map +1 -1
- package/lib/esm/tests/exports.js.map +1 -1
- package/lib/esm/tests/testAcceptMime.js.map +1 -1
- package/lib/esm/tests/testAuth.js.map +1 -1
- package/lib/esm/tests/testBodyParams.js +2 -2
- package/lib/esm/tests/testBodyParams.js.map +1 -1
- package/lib/esm/tests/testCache.js.map +1 -1
- package/lib/esm/tests/testChildrenControllers.js.map +1 -1
- package/lib/esm/tests/testCookies.js.map +1 -1
- package/lib/esm/tests/testCtrlInheritance.js.map +1 -1
- package/lib/esm/tests/testCustom404.js.map +1 -1
- package/lib/esm/tests/testErrors.js.map +1 -1
- package/lib/esm/tests/testHandlers.js.map +1 -1
- package/lib/esm/tests/testHeaderParams.js.map +1 -1
- package/lib/esm/tests/testHeaders.js.map +1 -1
- package/lib/esm/tests/testInheritanceController.js.map +1 -1
- package/lib/esm/tests/testLocals.js.map +1 -1
- package/lib/esm/tests/testLocation.js.map +1 -1
- package/lib/esm/tests/testMiddlewares.js.map +1 -1
- package/lib/esm/tests/testModule.js.map +1 -1
- package/lib/esm/tests/testMulter.js +12 -5
- package/lib/esm/tests/testMulter.js.map +1 -1
- package/lib/esm/tests/testPathParams.js.map +1 -1
- package/lib/esm/tests/testQueryParams.js.map +1 -1
- package/lib/esm/tests/testRedirect.js.map +1 -1
- package/lib/esm/tests/testResponse.js.map +1 -1
- package/lib/esm/tests/testResponseFilter.js.map +1 -1
- package/lib/esm/tests/testRouting.js.map +1 -1
- package/lib/esm/tests/testScopeRequest.js.map +1 -1
- package/lib/esm/tests/testSession.js.map +1 -1
- package/lib/esm/tests/testStatics.js.map +1 -1
- package/lib/esm/tests/testView.js.map +1 -1
- package/lib/tsconfig.esm.tsbuildinfo +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/package.json +25 -22
- package/src/tests/testBodyParams.ts +2 -2
- package/src/tests/testMulter.ts +16 -8
- package/tsconfig.esm.json +63 -0
- package/tsconfig.json +63 -0
- package/tsconfig.compile.esm.json +0 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/platform-test-sdk",
|
|
3
|
-
"version": "7.18.3
|
|
3
|
+
"version": "7.18.3",
|
|
4
4
|
"description": "Package to test platform adapter integration with Ts.ED",
|
|
5
5
|
"private": false,
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -14,10 +14,11 @@
|
|
|
14
14
|
"default": "./lib/esm/index.js"
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
17
|
-
"build": "yarn barrels && yarn
|
|
18
|
-
"
|
|
19
|
-
"build:
|
|
20
|
-
"
|
|
17
|
+
"build": "yarn barrels && yarn build:ts",
|
|
18
|
+
"barrels": "yarn barrelsby --delete -d ./src -d ./src/interfaces -e \"\\.spec\\.ts\" -e \"__mock__\" -e \".benchmark.ts\"",
|
|
19
|
+
"build:ts": "tsc --build tsconfig.json && tsc --build tsconfig.esm.json",
|
|
20
|
+
"lint": "eslint '**/*.{ts,js}'",
|
|
21
|
+
"lint:fix": "eslint '**/*.{ts,js}' --fix"
|
|
21
22
|
},
|
|
22
23
|
"keywords": [
|
|
23
24
|
"Ts.ED",
|
|
@@ -27,22 +28,27 @@
|
|
|
27
28
|
"Adapter"
|
|
28
29
|
],
|
|
29
30
|
"dependencies": {
|
|
30
|
-
"@tsed/ajv": "7.18.3
|
|
31
|
-
"@tsed/common": "7.18.3
|
|
32
|
-
"@tsed/core": "7.18.3
|
|
33
|
-
"@tsed/di": "7.18.3
|
|
34
|
-
"@tsed/json-mapper": "7.18.3
|
|
31
|
+
"@tsed/ajv": "7.18.3",
|
|
32
|
+
"@tsed/common": "7.18.3",
|
|
33
|
+
"@tsed/core": "7.18.3",
|
|
34
|
+
"@tsed/di": "7.18.3",
|
|
35
|
+
"@tsed/json-mapper": "7.18.3",
|
|
35
36
|
"@tsed/logger": "6.2.2",
|
|
36
|
-
"@tsed/platform-cache": "7.18.3
|
|
37
|
-
"@tsed/platform-params": "7.18.3
|
|
38
|
-
"@tsed/platform-router": "7.18.3
|
|
39
|
-
"@tsed/platform-views": "7.18.3
|
|
40
|
-
"@tsed/schema": "7.18.3
|
|
41
|
-
"@tsed/swagger": "7.18.3
|
|
37
|
+
"@tsed/platform-cache": "7.18.3",
|
|
38
|
+
"@tsed/platform-params": "7.18.3",
|
|
39
|
+
"@tsed/platform-router": "7.18.3",
|
|
40
|
+
"@tsed/platform-views": "7.18.3",
|
|
41
|
+
"@tsed/schema": "7.18.3",
|
|
42
|
+
"@tsed/swagger": "7.18.3",
|
|
42
43
|
"ajv": "^8.12.0",
|
|
43
|
-
"axios": "^1.3.0"
|
|
44
|
+
"axios": "^1.3.0",
|
|
45
|
+
"read-pkg-up": "7.0.1"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@tsed/eslint": "7.18.3",
|
|
49
|
+
"@tsed/typescript": "7.18.3",
|
|
50
|
+
"eslint": "^8.12.0"
|
|
44
51
|
},
|
|
45
|
-
"devDependencies": {},
|
|
46
52
|
"peerDependencies": {},
|
|
47
53
|
"repository": "https://github.com/tsedio/tsed",
|
|
48
54
|
"bugs": {
|
|
@@ -50,8 +56,5 @@
|
|
|
50
56
|
},
|
|
51
57
|
"homepage": "https://github.com/tsedio/tsed/tree/production/packages/platform/platform-test-sdk",
|
|
52
58
|
"author": "Romain Lenzotti",
|
|
53
|
-
"license": "MIT"
|
|
54
|
-
"publishConfig": {
|
|
55
|
-
"tag": "rc"
|
|
56
|
-
}
|
|
59
|
+
"license": "MIT"
|
|
57
60
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "@tsed/ajv";
|
|
2
|
-
import {BodyParams, Context, Controller, HeaderParams, PlatformTest,
|
|
3
|
-
import {Default, Description, GenericOf, Generics, Maximum, Minimum, Nullable, Property, Required, Status} from "@tsed/schema";
|
|
2
|
+
import {BodyParams, Context, Controller, HeaderParams, PlatformTest, RawBodyParams} from "@tsed/common";
|
|
3
|
+
import {Post, Default, Description, GenericOf, Generics, Maximum, Minimum, Nullable, Property, Required, Status} from "@tsed/schema";
|
|
4
4
|
import SuperTest from "supertest";
|
|
5
5
|
import {PlatformTestingSdkOpts} from "../interfaces";
|
|
6
6
|
|
package/src/tests/testMulter.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {BodyParams, Controller, MulterOptions, MultipartFile, PlatformMulterFile, PlatformTest
|
|
2
|
-
import {CollectionOf, Property, Required, Status} from "@tsed/schema";
|
|
3
|
-
import {Request} from "express";
|
|
1
|
+
import {BodyParams, Controller, MulterOptions, MultipartFile, PlatformMulterFile, PlatformTest} from "@tsed/common";
|
|
2
|
+
import {CollectionOf, Post, Property, Required, Status} from "@tsed/schema";
|
|
4
3
|
import filedirname from "filedirname";
|
|
5
4
|
import multer, {FileFilterCallback} from "multer";
|
|
5
|
+
import {dirname, join} from "path";
|
|
6
|
+
import readPkgUp from "read-pkg-up";
|
|
6
7
|
import SuperTest from "supertest";
|
|
7
8
|
import {PlatformTestingSdkOpts} from "../interfaces";
|
|
8
9
|
|
|
@@ -27,7 +28,7 @@ export class Event {
|
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
const fileFilterStub = jest.fn();
|
|
30
|
-
const fileFilter = (req:
|
|
31
|
+
const fileFilter = (req: any, file: PlatformMulterFile, callback: FileFilterCallback) => {
|
|
31
32
|
fileFilterStub();
|
|
32
33
|
callback(null, true);
|
|
33
34
|
};
|
|
@@ -35,7 +36,7 @@ const fileFilter = (req: Request, file: PlatformMulterFile, callback: FileFilter
|
|
|
35
36
|
function getFileConfig(): any {
|
|
36
37
|
return {
|
|
37
38
|
storage: multer.diskStorage({
|
|
38
|
-
destination: (req:
|
|
39
|
+
destination: (req: any, _fileItem, cb) => {
|
|
39
40
|
const path = `${rootDir}/../.tmp`;
|
|
40
41
|
cb(null, path);
|
|
41
42
|
}
|
|
@@ -76,6 +77,13 @@ export class TestMulterController {
|
|
|
76
77
|
export function testMulter(options: PlatformTestingSdkOpts) {
|
|
77
78
|
let request: SuperTest.SuperTest<SuperTest.Test>;
|
|
78
79
|
|
|
80
|
+
const buffer = Buffer.from("test content");
|
|
81
|
+
|
|
82
|
+
const pkg = readPkgUp.sync({
|
|
83
|
+
cwd: __dirname
|
|
84
|
+
});
|
|
85
|
+
const rootDir = join(dirname(pkg?.path || ""), "src");
|
|
86
|
+
|
|
79
87
|
beforeAll(
|
|
80
88
|
PlatformTest.bootstrap(options.server, {
|
|
81
89
|
...options,
|
|
@@ -91,7 +99,7 @@ export function testMulter(options: PlatformTestingSdkOpts) {
|
|
|
91
99
|
beforeAll(() => jest.resetAllMocks());
|
|
92
100
|
describe("Scenario 1: POST /rest/multer/scenario-1", () => {
|
|
93
101
|
it("should upload file with multer", async () => {
|
|
94
|
-
const result = await request.post("/rest/multer/scenario-1").attach("media", `${rootDir}
|
|
102
|
+
const result = await request.post("/rest/multer/scenario-1").attach("media", `${rootDir}/data/file.txt`).expect(201);
|
|
95
103
|
|
|
96
104
|
expect(result.text).toEqual("file.txt");
|
|
97
105
|
});
|
|
@@ -120,7 +128,7 @@ export function testMulter(options: PlatformTestingSdkOpts) {
|
|
|
120
128
|
it("should upload file with multer", async () => {
|
|
121
129
|
const result = await request
|
|
122
130
|
.post("/rest/multer/scenario-2")
|
|
123
|
-
.attach("media", `${rootDir}
|
|
131
|
+
.attach("media", `${rootDir}/data/file.txt`)
|
|
124
132
|
.field({
|
|
125
133
|
form_id: "form_id"
|
|
126
134
|
})
|
|
@@ -131,7 +139,7 @@ export function testMulter(options: PlatformTestingSdkOpts) {
|
|
|
131
139
|
});
|
|
132
140
|
describe("Scenario 3: POST /rest/multer/scenario-3", () => {
|
|
133
141
|
it("should upload file with multer", async () => {
|
|
134
|
-
const result = await request.post("/rest/multer/scenario-3").attach("media", `${rootDir}
|
|
142
|
+
const result = await request.post("/rest/multer/scenario-3").attach("media", `${rootDir}/data/file.txt`).field({}).expect(201);
|
|
135
143
|
|
|
136
144
|
expect(result.body).toEqual({
|
|
137
145
|
file: "file.txt"
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "@tsed/typescript/tsconfig.node.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"baseUrl": ".",
|
|
5
|
+
"module": "ES2020",
|
|
6
|
+
"rootDir": "src",
|
|
7
|
+
"outDir": "./lib/esm",
|
|
8
|
+
"declaration": true,
|
|
9
|
+
"declarationDir": "./lib/types",
|
|
10
|
+
"composite": true,
|
|
11
|
+
"noEmit": false
|
|
12
|
+
},
|
|
13
|
+
"include": ["src", "src/**/*.json"],
|
|
14
|
+
"exclude": [
|
|
15
|
+
"node_modules",
|
|
16
|
+
"test",
|
|
17
|
+
"lib",
|
|
18
|
+
"benchmark",
|
|
19
|
+
"coverage",
|
|
20
|
+
"spec",
|
|
21
|
+
"**/*.benchmark.ts",
|
|
22
|
+
"**/*.spec.ts",
|
|
23
|
+
"keys",
|
|
24
|
+
"jest.config.js",
|
|
25
|
+
"**/__mock__/**",
|
|
26
|
+
"webpack.config.js"
|
|
27
|
+
],
|
|
28
|
+
"references": [
|
|
29
|
+
{
|
|
30
|
+
"path": "../../specs/ajv"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"path": "../common"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"path": "../../core"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"path": "../../di"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"path": "../../specs/json-mapper"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"path": "../platform-cache"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"path": "../platform-params"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"path": "../platform-router"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"path": "../platform-views"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"path": "../../specs/schema"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"path": "../../specs/swagger"
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "@tsed/typescript/tsconfig.node.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"baseUrl": ".",
|
|
5
|
+
"module": "commonjs",
|
|
6
|
+
"rootDir": "src",
|
|
7
|
+
"outDir": "./lib/cjs",
|
|
8
|
+
"declaration": true,
|
|
9
|
+
"declarationDir": "./lib/types",
|
|
10
|
+
"composite": true,
|
|
11
|
+
"noEmit": false
|
|
12
|
+
},
|
|
13
|
+
"include": ["src", "src/**/*.json"],
|
|
14
|
+
"exclude": [
|
|
15
|
+
"node_modules",
|
|
16
|
+
"test",
|
|
17
|
+
"lib",
|
|
18
|
+
"benchmark",
|
|
19
|
+
"coverage",
|
|
20
|
+
"spec",
|
|
21
|
+
"**/*.benchmark.ts",
|
|
22
|
+
"**/*.spec.ts",
|
|
23
|
+
"keys",
|
|
24
|
+
"jest.config.js",
|
|
25
|
+
"**/__mock__/**",
|
|
26
|
+
"webpack.config.js"
|
|
27
|
+
],
|
|
28
|
+
"references": [
|
|
29
|
+
{
|
|
30
|
+
"path": "../../specs/ajv"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"path": "../common"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"path": "../../core"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"path": "../../di"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"path": "../../specs/json-mapper"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"path": "../platform-cache"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"path": "../platform-params"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"path": "../platform-router"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"path": "../platform-views"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"path": "../../specs/schema"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"path": "../../specs/swagger"
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "./tsconfig.compile.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"baseUrl": ".",
|
|
5
|
-
"module": "ES2020",
|
|
6
|
-
"rootDir": "src",
|
|
7
|
-
"outDir": "./lib/esm",
|
|
8
|
-
"declaration": true,
|
|
9
|
-
"declarationDir": "./lib/types"
|
|
10
|
-
},
|
|
11
|
-
"exclude": ["node_modules", "test", "lib", "benchmark", "coverage", "spec", "**/*.benchmark.ts", "**/*.spec.ts", "keys", "jest.config.js"]
|
|
12
|
-
}
|