@nocobase/test 1.5.0-beta.8 → 1.5.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.
|
@@ -69,7 +69,7 @@ export declare class MockServer extends Application {
|
|
|
69
69
|
clean?: boolean;
|
|
70
70
|
}): Promise<void>;
|
|
71
71
|
destroy(options?: any): Promise<void>;
|
|
72
|
-
agent(): ExtendedAgent;
|
|
72
|
+
agent(callback?: any): ExtendedAgent;
|
|
73
73
|
protected createDatabase(options: ApplicationOptions): import("@nocobase/database").MockDatabase;
|
|
74
74
|
}
|
|
75
75
|
export declare function mockServer(options?: ApplicationOptions): MockServer;
|
|
@@ -12313,7 +12313,7 @@ const oneFilterFormBlockWithAllAssociationFieldsV1333Beta = {
|
|
|
12313
12313
|
"x-use-decorator-props": "useFormItemProps",
|
|
12314
12314
|
"x-collection-field": "general.oneToOneBelongsTo",
|
|
12315
12315
|
"x-component-props": {
|
|
12316
|
-
multiple:
|
|
12316
|
+
multiple: true,
|
|
12317
12317
|
fieldNames: {
|
|
12318
12318
|
label: "id",
|
|
12319
12319
|
value: "id"
|
|
@@ -12360,7 +12360,7 @@ const oneFilterFormBlockWithAllAssociationFieldsV1333Beta = {
|
|
|
12360
12360
|
"x-use-decorator-props": "useFormItemProps",
|
|
12361
12361
|
"x-collection-field": "general.oneToOneHasOne",
|
|
12362
12362
|
"x-component-props": {
|
|
12363
|
-
multiple:
|
|
12363
|
+
multiple: true,
|
|
12364
12364
|
fieldNames: {
|
|
12365
12365
|
label: "id",
|
|
12366
12366
|
value: "id"
|
|
@@ -12454,7 +12454,7 @@ const oneFilterFormBlockWithAllAssociationFieldsV1333Beta = {
|
|
|
12454
12454
|
"x-use-decorator-props": "useFormItemProps",
|
|
12455
12455
|
"x-collection-field": "general.manyToOne",
|
|
12456
12456
|
"x-component-props": {
|
|
12457
|
-
multiple:
|
|
12457
|
+
multiple: true,
|
|
12458
12458
|
fieldNames: {
|
|
12459
12459
|
label: "id",
|
|
12460
12460
|
value: "id"
|
|
@@ -69,7 +69,7 @@ export declare class MockServer extends Application {
|
|
|
69
69
|
clean?: boolean;
|
|
70
70
|
}): Promise<void>;
|
|
71
71
|
destroy(options?: any): Promise<void>;
|
|
72
|
-
agent(): ExtendedAgent;
|
|
72
|
+
agent(callback?: any): ExtendedAgent;
|
|
73
73
|
protected createDatabase(options: ApplicationOptions): import("@nocobase/database").MockDatabase;
|
|
74
74
|
}
|
|
75
75
|
export declare function mockServer(options?: ApplicationOptions): MockServer;
|
|
@@ -53,6 +53,9 @@ var import_qs = __toESM(require("qs"));
|
|
|
53
53
|
var import_supertest = __toESM(require("supertest"));
|
|
54
54
|
var import_memory_pub_sub_adapter = require("./memory-pub-sub-adapter");
|
|
55
55
|
var import_mock_data_source = require("./mock-data-source");
|
|
56
|
+
var import_path = __toESM(require("path"));
|
|
57
|
+
var import_node_process = __toESM(require("node:process"));
|
|
58
|
+
var import_fs = require("fs");
|
|
56
59
|
const _MockServer = class _MockServer extends import_server.Application {
|
|
57
60
|
registerMockDataSource() {
|
|
58
61
|
this.dataSourceManager.factory.register("mock", import_mock_data_source.MockDataSource);
|
|
@@ -87,8 +90,8 @@ const _MockServer = class _MockServer extends import_server.Application {
|
|
|
87
90
|
import_server.Gateway.getInstance().destroy();
|
|
88
91
|
await import_server.AppSupervisor.getInstance().destroy();
|
|
89
92
|
}
|
|
90
|
-
agent() {
|
|
91
|
-
const agent = import_supertest.default.agent(this.callback());
|
|
93
|
+
agent(callback) {
|
|
94
|
+
const agent = import_supertest.default.agent(callback || this.callback());
|
|
92
95
|
const prefix = this.resourcer.options.prefix;
|
|
93
96
|
const proxy = new Proxy(agent, {
|
|
94
97
|
get(target, method, receiver) {
|
|
@@ -101,7 +104,7 @@ const _MockServer = class _MockServer extends import_server.Application {
|
|
|
101
104
|
temp: true,
|
|
102
105
|
roleName
|
|
103
106
|
},
|
|
104
|
-
|
|
107
|
+
import_node_process.default.env.APP_KEY,
|
|
105
108
|
{
|
|
106
109
|
expiresIn: "1d"
|
|
107
110
|
}
|
|
@@ -253,6 +256,12 @@ async function createMockCluster({
|
|
|
253
256
|
}
|
|
254
257
|
__name(createMockCluster, "createMockCluster");
|
|
255
258
|
async function createMockServer(options = {}) {
|
|
259
|
+
const cachePath = import_path.default.join(import_node_process.default.cwd(), "storage", "cache");
|
|
260
|
+
try {
|
|
261
|
+
await import_fs.promises.rm(cachePath, { recursive: true, force: true });
|
|
262
|
+
await import_fs.promises.mkdir(cachePath, { recursive: true });
|
|
263
|
+
} catch (e) {
|
|
264
|
+
}
|
|
256
265
|
const { version, beforeInstall, skipInstall, skipStart, ...others } = options;
|
|
257
266
|
const app = mockServer(others);
|
|
258
267
|
if (!skipInstall) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/test",
|
|
3
|
-
"version": "1.5.0
|
|
3
|
+
"version": "1.5.0",
|
|
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.5.0
|
|
54
|
+
"@nocobase/server": "1.5.0",
|
|
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": "1eae52e1fc837e9b1c6b63fc31bda7945b6101e9"
|
|
80
80
|
}
|