@nocobase/test 1.6.0-alpha.2 → 1.6.0-alpha.4
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.
|
@@ -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 {
|
|
@@ -93,12 +93,13 @@ const _MockServer = class _MockServer extends import_server.Application {
|
|
|
93
93
|
const proxy = new Proxy(agent, {
|
|
94
94
|
get(target, method, receiver) {
|
|
95
95
|
if (["login", "loginUsingId"].includes(method)) {
|
|
96
|
-
return (userOrId) => {
|
|
96
|
+
return (userOrId, roleName) => {
|
|
97
97
|
return proxy.auth(
|
|
98
98
|
import_jsonwebtoken.default.sign(
|
|
99
99
|
{
|
|
100
100
|
userId: typeof userOrId === "number" ? userOrId : userOrId == null ? void 0 : userOrId.id,
|
|
101
|
-
temp: true
|
|
101
|
+
temp: true,
|
|
102
|
+
roleName
|
|
102
103
|
},
|
|
103
104
|
process.env.APP_KEY,
|
|
104
105
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/test",
|
|
3
|
-
"version": "1.6.0-alpha.
|
|
3
|
+
"version": "1.6.0-alpha.4",
|
|
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.6.0-alpha.
|
|
54
|
+
"@nocobase/server": "1.6.0-alpha.4",
|
|
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": "595d5236feda9258791dac76270494721813b7e1"
|
|
80
80
|
}
|