@nocobase/test 1.4.1 → 1.4.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/es/index.mjs
CHANGED
|
@@ -48,12 +48,13 @@ class MockServer extends Application {
|
|
|
48
48
|
const proxy = new Proxy(agent, {
|
|
49
49
|
get(target, method, receiver) {
|
|
50
50
|
if (["login", "loginUsingId"].includes(method)) {
|
|
51
|
-
return (userOrId) => {
|
|
51
|
+
return (userOrId, roleName) => {
|
|
52
52
|
return proxy.auth(
|
|
53
53
|
jwt.sign(
|
|
54
54
|
{
|
|
55
55
|
userId: typeof userOrId === "number" ? userOrId : userOrId == null ? void 0 : userOrId.id,
|
|
56
|
-
temp: true
|
|
56
|
+
temp: true,
|
|
57
|
+
roleName
|
|
57
58
|
},
|
|
58
59
|
process.env.APP_KEY,
|
|
59
60
|
{
|
|
@@ -57,8 +57,8 @@ interface Resource {
|
|
|
57
57
|
[name: string]: (params?: ActionParams) => Promise<supertest.Response>;
|
|
58
58
|
}
|
|
59
59
|
interface ExtendedAgent extends SuperAgentTest {
|
|
60
|
-
login: (user: any) => ExtendedAgent;
|
|
61
|
-
loginUsingId: (userId: number) => ExtendedAgent;
|
|
60
|
+
login: (user: any, roleName?: string) => ExtendedAgent;
|
|
61
|
+
loginUsingId: (userId: number, roleName?: string) => ExtendedAgent;
|
|
62
62
|
resource: (name: string, resourceOf?: any) => Resource;
|
|
63
63
|
}
|
|
64
64
|
export declare class MockServer extends Application {
|
|
@@ -57,8 +57,8 @@ interface Resource {
|
|
|
57
57
|
[name: string]: (params?: ActionParams) => Promise<supertest.Response>;
|
|
58
58
|
}
|
|
59
59
|
interface ExtendedAgent extends SuperAgentTest {
|
|
60
|
-
login: (user: any) => ExtendedAgent;
|
|
61
|
-
loginUsingId: (userId: number) => ExtendedAgent;
|
|
60
|
+
login: (user: any, roleName?: string) => ExtendedAgent;
|
|
61
|
+
loginUsingId: (userId: number, roleName?: string) => ExtendedAgent;
|
|
62
62
|
resource: (name: string, resourceOf?: any) => Resource;
|
|
63
63
|
}
|
|
64
64
|
export declare class MockServer extends Application {
|
|
@@ -86,12 +86,13 @@ const _MockServer = class _MockServer extends import_server.Application {
|
|
|
86
86
|
const proxy = new Proxy(agent, {
|
|
87
87
|
get(target, method, receiver) {
|
|
88
88
|
if (["login", "loginUsingId"].includes(method)) {
|
|
89
|
-
return (userOrId) => {
|
|
89
|
+
return (userOrId, roleName) => {
|
|
90
90
|
return proxy.auth(
|
|
91
91
|
import_jsonwebtoken.default.sign(
|
|
92
92
|
{
|
|
93
93
|
userId: typeof userOrId === "number" ? userOrId : userOrId == null ? void 0 : userOrId.id,
|
|
94
|
-
temp: true
|
|
94
|
+
temp: true,
|
|
95
|
+
roleName
|
|
95
96
|
},
|
|
96
97
|
process.env.APP_KEY,
|
|
97
98
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/test",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.3",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"module": "./src/index.ts",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"@faker-js/faker": "8.1.0",
|
|
54
|
-
"@nocobase/server": "1.4.
|
|
54
|
+
"@nocobase/server": "1.4.3",
|
|
55
55
|
"@playwright/test": "^1.45.3",
|
|
56
56
|
"@testing-library/jest-dom": "^6.4.2",
|
|
57
57
|
"@testing-library/react": "^14.0.0",
|
|
@@ -76,5 +76,5 @@
|
|
|
76
76
|
"vitest-dom": "^0.1.1",
|
|
77
77
|
"ws": "^8.13.0"
|
|
78
78
|
},
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "09fcb6aaab2c0630aa03335d8a25655a32c5b6a6"
|
|
80
80
|
}
|