@jaypie/testkit 1.0.29 → 1.1.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/LICENSE.txt +21 -0
- package/README.md +1 -1
- package/package.json +10 -22
- package/src/jaypie.mock.js +1 -1
- package/src/matchers/toBeCalledAboveTrace.matcher.js +1 -10
- package/src/matchers/toBeClass.matcher.js +2 -12
- package/src/sqsTestRecords.function.js +0 -11
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Finlayson Studio, LLC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jaypie/testkit",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"license": "MIT",
|
|
4
5
|
"author": "Finlayson Studio",
|
|
5
6
|
"type": "module",
|
|
6
7
|
"exports": {
|
|
@@ -12,17 +13,8 @@
|
|
|
12
13
|
"format": "npm run format:package && npm run format:lint",
|
|
13
14
|
"format:lint": "eslint --fix .",
|
|
14
15
|
"format:package": "sort-package-json ./package.json",
|
|
15
|
-
"init:commander": "hygen jaypie commander-init",
|
|
16
|
-
"init:deploy": "hygen jaypie workflow-npm",
|
|
17
16
|
"lint": "eslint .",
|
|
18
|
-
"
|
|
19
|
-
"new:command": "hygen jaypie command",
|
|
20
|
-
"new:constants": "hygen jaypie constants",
|
|
21
|
-
"new:hygen": "hygen jaypie hygen",
|
|
22
|
-
"new:index": "hygen jaypie index",
|
|
23
|
-
"new:model": "hygen jaypie model",
|
|
24
|
-
"new:test": "hygen jaypie vitest",
|
|
25
|
-
"test": "vitest",
|
|
17
|
+
"test": "vitest run .",
|
|
26
18
|
"test:spec:constants": "vitest run ./src/__tests__/constants.spec.js",
|
|
27
19
|
"test:spec:expressHandler.mock": "vitest run ./src/__tests__/expressHandler-supertest.mock.spec.js",
|
|
28
20
|
"test:spec:index": "vitest run ./src/__tests__/index.spec.js",
|
|
@@ -39,21 +31,17 @@
|
|
|
39
31
|
"test:spec:toThrowJaypieError.matcher": "vitest run ./src/matchers/__tests__/toThrowJaypieError.matcher.spec.js"
|
|
40
32
|
},
|
|
41
33
|
"dependencies": {
|
|
42
|
-
"@jaypie/core": "^1.0
|
|
34
|
+
"@jaypie/core": "^1.1.0",
|
|
43
35
|
"jaypie": "^1.0.44",
|
|
44
36
|
"jest-json-schema": "^6.1.0",
|
|
45
37
|
"lodash.isequal": "^4.5.0",
|
|
46
38
|
"uuid": "^9.0.1"
|
|
47
39
|
},
|
|
48
40
|
"devDependencies": {
|
|
49
|
-
"
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
"
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
"sort-package-json": "^2.8.0",
|
|
56
|
-
"supertest": "^7.0.0",
|
|
57
|
-
"vitest": "^1.4.0"
|
|
58
|
-
}
|
|
41
|
+
"express": "^4.21.1"
|
|
42
|
+
},
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"access": "public"
|
|
45
|
+
},
|
|
46
|
+
"gitHead": "26b6847fa8b061594bd899c2e098822dad198e51"
|
|
59
47
|
}
|
package/src/jaypie.mock.js
CHANGED
|
@@ -263,7 +263,6 @@ export const expressHandler = vi.fn((handler, props = {}) => {
|
|
|
263
263
|
for (let i = 0; i < keys.length; i += 1) {
|
|
264
264
|
const key = keys[i];
|
|
265
265
|
if (typeof props.locals[key] === "function") {
|
|
266
|
-
// eslint-disable-next-line no-await-in-loop
|
|
267
266
|
localsReq.locals[key] = await props.locals[key](
|
|
268
267
|
localsReq,
|
|
269
268
|
localsRes,
|
|
@@ -322,6 +321,7 @@ export const expressHandler = vi.fn((handler, props = {}) => {
|
|
|
322
321
|
} else if (typeof response === "string") {
|
|
323
322
|
try {
|
|
324
323
|
res.status(status).json(JSON.parse(response));
|
|
324
|
+
// eslint-disable-next-line no-unused-vars
|
|
325
325
|
} catch (error) {
|
|
326
326
|
if (supertestMode) {
|
|
327
327
|
res.status(status).send(response);
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
// Constants
|
|
4
|
-
//
|
|
5
|
-
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
// Helper Functions
|
|
9
|
-
//
|
|
10
|
-
|
|
11
1
|
//
|
|
12
2
|
//
|
|
13
3
|
// Main
|
|
@@ -29,6 +19,7 @@ const calledAboveTrace = (log) => {
|
|
|
29
19
|
pass: true,
|
|
30
20
|
};
|
|
31
21
|
}
|
|
22
|
+
// eslint-disable-next-line no-unused-vars
|
|
32
23
|
} catch (error) {
|
|
33
24
|
throw Error(`[calledAboveTrace] log is not a mock object`);
|
|
34
25
|
}
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
// Constants
|
|
4
|
-
//
|
|
5
|
-
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
// Helper Functions
|
|
9
|
-
//
|
|
10
|
-
|
|
11
1
|
//
|
|
12
2
|
//
|
|
13
3
|
// Main
|
|
@@ -17,10 +7,10 @@ const toBeClass = (received) => {
|
|
|
17
7
|
let pass = false;
|
|
18
8
|
if (typeof received === "function") {
|
|
19
9
|
try {
|
|
20
|
-
// eslint-disable-next-line new-cap, no-new
|
|
21
10
|
new received();
|
|
22
11
|
pass = true;
|
|
23
|
-
|
|
12
|
+
// eslint-disable-next-line no-unused-vars
|
|
13
|
+
} catch (error) {
|
|
24
14
|
pass = false;
|
|
25
15
|
}
|
|
26
16
|
}
|
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
import { v4 as uuid } from "uuid";
|
|
2
2
|
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
// Constants
|
|
6
|
-
//
|
|
7
|
-
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
// Helper Functions
|
|
11
|
-
//
|
|
12
|
-
|
|
13
3
|
//
|
|
14
4
|
//
|
|
15
5
|
// Main
|
|
@@ -20,7 +10,6 @@ const sqsTestRecords = (...args) => {
|
|
|
20
10
|
|
|
21
11
|
// See if only a single array was passed in and spread it
|
|
22
12
|
if (args.length === 1 && Array.isArray(args[0])) {
|
|
23
|
-
// eslint-disable-next-line no-param-reassign
|
|
24
13
|
[args] = args;
|
|
25
14
|
}
|
|
26
15
|
|