@nocobase/test 1.2.34-alpha → 1.2.36-alpha
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/client/index.mjs +1 -1
- package/lib/client/index.js +1 -1
- package/lib/e2e/e2eUtils.js +42 -42
- package/lib/scripts/test-db-creator.js +6 -6
- package/lib/web/index.js +1 -2
- package/package.json +4 -4
package/es/client/index.mjs
CHANGED
|
@@ -1569,7 +1569,7 @@ function withSchema(Component, name) {
|
|
|
1569
1569
|
"x-decorator-props",
|
|
1570
1570
|
"x-linkage-rules"
|
|
1571
1571
|
]);
|
|
1572
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("pre", { "data-testid":
|
|
1572
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("pre", { "data-testid": `test-schema` }, JSON.stringify(schemaValue, void 0, 2)), /* @__PURE__ */ React.createElement(Component, { ...props }));
|
|
1573
1573
|
});
|
|
1574
1574
|
ComponentValue.displayName = `withSchema(${Component.displayName || Component.name})`;
|
|
1575
1575
|
return ComponentValue;
|
package/lib/client/index.js
CHANGED
|
@@ -61,7 +61,7 @@ __reExport(client_exports, require("./commonSettingsChecker"), module.exports);
|
|
|
61
61
|
function customRender(ui, options = {}) {
|
|
62
62
|
return (0, import_react2.render)(ui, {
|
|
63
63
|
// wrap provider(s) here if needed
|
|
64
|
-
wrapper: ({ children }) => children,
|
|
64
|
+
wrapper: /* @__PURE__ */ __name(({ children }) => children, "wrapper"),
|
|
65
65
|
...options
|
|
66
66
|
});
|
|
67
67
|
}
|
package/lib/e2e/e2eUtils.js
CHANGED
|
@@ -130,10 +130,10 @@ const getPage = /* @__PURE__ */ __name(async (browser) => {
|
|
|
130
130
|
return _page;
|
|
131
131
|
}, "getPage");
|
|
132
132
|
const _test = import_test.test.extend({
|
|
133
|
-
page: async ({ browser }, use) => {
|
|
133
|
+
page: /* @__PURE__ */ __name(async ({ browser }, use) => {
|
|
134
134
|
await use(await getPage(browser));
|
|
135
|
-
},
|
|
136
|
-
mockPage: async ({ browser }, use) => {
|
|
135
|
+
}, "page"),
|
|
136
|
+
mockPage: /* @__PURE__ */ __name(async ({ browser }, use) => {
|
|
137
137
|
const page = await getPage(browser);
|
|
138
138
|
const nocoPages = [];
|
|
139
139
|
const mockPage = /* @__PURE__ */ __name((config) => {
|
|
@@ -149,15 +149,15 @@ const _test = import_test.test.extend({
|
|
|
149
149
|
waitList.push(setDefaultRole("root"));
|
|
150
150
|
waitList.push(removeRedundantUserAndRoles());
|
|
151
151
|
await Promise.all(waitList);
|
|
152
|
-
},
|
|
153
|
-
mockManualDestroyPage: async ({ browser }, use) => {
|
|
152
|
+
}, "mockPage"),
|
|
153
|
+
mockManualDestroyPage: /* @__PURE__ */ __name(async ({ browser }, use) => {
|
|
154
154
|
const mockManualDestroyPage = /* @__PURE__ */ __name((config) => {
|
|
155
155
|
const nocoPage = new NocoPage(config);
|
|
156
156
|
return nocoPage;
|
|
157
157
|
}, "mockManualDestroyPage");
|
|
158
158
|
await use(mockManualDestroyPage);
|
|
159
|
-
},
|
|
160
|
-
createCollections: async ({ browser }, use) => {
|
|
159
|
+
}, "mockManualDestroyPage"),
|
|
160
|
+
createCollections: /* @__PURE__ */ __name(async ({ browser }, use) => {
|
|
161
161
|
let collectionsName = [];
|
|
162
162
|
const _createCollections = /* @__PURE__ */ __name(async (collectionSettings) => {
|
|
163
163
|
collectionSettings = omitSomeFields(
|
|
@@ -170,8 +170,8 @@ const _test = import_test.test.extend({
|
|
|
170
170
|
if (collectionsName.length) {
|
|
171
171
|
await deleteCollections(import_lodash.default.uniq(collectionsName));
|
|
172
172
|
}
|
|
173
|
-
},
|
|
174
|
-
mockCollections: async ({ browser }, use) => {
|
|
173
|
+
}, "createCollections"),
|
|
174
|
+
mockCollections: /* @__PURE__ */ __name(async ({ browser }, use) => {
|
|
175
175
|
let collectionsName = [];
|
|
176
176
|
const destroy = /* @__PURE__ */ __name(async () => {
|
|
177
177
|
if (collectionsName.length) {
|
|
@@ -185,8 +185,8 @@ const _test = import_test.test.extend({
|
|
|
185
185
|
}, "mockCollections");
|
|
186
186
|
await use(mockCollections);
|
|
187
187
|
await destroy();
|
|
188
|
-
},
|
|
189
|
-
mockCollection: async ({ browser }, use) => {
|
|
188
|
+
}, "mockCollections"),
|
|
189
|
+
mockCollection: /* @__PURE__ */ __name(async ({ browser }, use) => {
|
|
190
190
|
let collectionsName = [];
|
|
191
191
|
const destroy = /* @__PURE__ */ __name(async () => {
|
|
192
192
|
if (collectionsName.length) {
|
|
@@ -200,8 +200,8 @@ const _test = import_test.test.extend({
|
|
|
200
200
|
}, "mockCollection");
|
|
201
201
|
await use(mockCollection);
|
|
202
202
|
await destroy();
|
|
203
|
-
},
|
|
204
|
-
mockRecords: async ({ browser }, use) => {
|
|
203
|
+
}, "mockCollection"),
|
|
204
|
+
mockRecords: /* @__PURE__ */ __name(async ({ browser }, use) => {
|
|
205
205
|
const mockRecords = /* @__PURE__ */ __name(async (collectionName, count = 3, data) => {
|
|
206
206
|
let maxDepth;
|
|
207
207
|
if (import_lodash.default.isNumber(data)) {
|
|
@@ -215,8 +215,8 @@ const _test = import_test.test.extend({
|
|
|
215
215
|
return createRandomData(collectionName, count, data, maxDepth);
|
|
216
216
|
}, "mockRecords");
|
|
217
217
|
await use(mockRecords);
|
|
218
|
-
},
|
|
219
|
-
mockRecord: async ({ browser }, use) => {
|
|
218
|
+
}, "mockRecords"),
|
|
219
|
+
mockRecord: /* @__PURE__ */ __name(async ({ browser }, use) => {
|
|
220
220
|
const mockRecord = /* @__PURE__ */ __name(async (collectionName, data, maxDepth) => {
|
|
221
221
|
if (import_lodash.default.isNumber(data)) {
|
|
222
222
|
maxDepth = data;
|
|
@@ -226,8 +226,8 @@ const _test = import_test.test.extend({
|
|
|
226
226
|
return result[0];
|
|
227
227
|
}, "mockRecord");
|
|
228
228
|
await use(mockRecord);
|
|
229
|
-
},
|
|
230
|
-
deletePage: async ({ browser }, use) => {
|
|
229
|
+
}, "mockRecord"),
|
|
230
|
+
deletePage: /* @__PURE__ */ __name(async ({ browser }, use) => {
|
|
231
231
|
const page = await getPage(browser);
|
|
232
232
|
const deletePage2 = /* @__PURE__ */ __name(async (pageName) => {
|
|
233
233
|
await page.getByText(pageName, { exact: true }).hover();
|
|
@@ -236,29 +236,29 @@ const _test = import_test.test.extend({
|
|
|
236
236
|
await page.getByRole("button", { name: "OK", exact: true }).click();
|
|
237
237
|
}, "deletePage");
|
|
238
238
|
await use(deletePage2);
|
|
239
|
-
},
|
|
240
|
-
mockRole: async ({ browser }, use) => {
|
|
239
|
+
}, "deletePage"),
|
|
240
|
+
mockRole: /* @__PURE__ */ __name(async ({ browser }, use) => {
|
|
241
241
|
const mockRole = /* @__PURE__ */ __name(async (roleSetting) => {
|
|
242
242
|
return createRole(roleSetting);
|
|
243
243
|
}, "mockRole");
|
|
244
244
|
await use(mockRole);
|
|
245
|
-
},
|
|
246
|
-
updateRole: async ({ browser }, use) => {
|
|
245
|
+
}, "mockRole"),
|
|
246
|
+
updateRole: /* @__PURE__ */ __name(async ({ browser }, use) => {
|
|
247
247
|
await use(updateRole);
|
|
248
|
-
},
|
|
249
|
-
mockExternalDataSource: async ({ browser }, use) => {
|
|
248
|
+
}, "updateRole"),
|
|
249
|
+
mockExternalDataSource: /* @__PURE__ */ __name(async ({ browser }, use) => {
|
|
250
250
|
const mockExternalDataSource = /* @__PURE__ */ __name(async (DataSourceSetting) => {
|
|
251
251
|
return createExternalDataSource(DataSourceSetting);
|
|
252
252
|
}, "mockExternalDataSource");
|
|
253
253
|
await use(mockExternalDataSource);
|
|
254
|
-
},
|
|
255
|
-
destoryExternalDataSource: async ({ browser }, use) => {
|
|
254
|
+
}, "mockExternalDataSource"),
|
|
255
|
+
destoryExternalDataSource: /* @__PURE__ */ __name(async ({ browser }, use) => {
|
|
256
256
|
const destoryDataSource = /* @__PURE__ */ __name(async (key) => {
|
|
257
257
|
return destoryExternalDataSource(key);
|
|
258
258
|
}, "destoryDataSource");
|
|
259
259
|
await use(destoryDataSource);
|
|
260
|
-
},
|
|
261
|
-
clearBlockTemplates: async ({ browser }, use) => {
|
|
260
|
+
}, "destoryExternalDataSource"),
|
|
261
|
+
clearBlockTemplates: /* @__PURE__ */ __name(async ({ browser }, use) => {
|
|
262
262
|
let ended = false;
|
|
263
263
|
let isImmediate = false;
|
|
264
264
|
const clearBlockTemplates = /* @__PURE__ */ __name(async ({ immediate } = { immediate: false }) => {
|
|
@@ -286,7 +286,7 @@ const _test = import_test.test.extend({
|
|
|
286
286
|
if (!isImmediate) {
|
|
287
287
|
await clearBlockTemplates();
|
|
288
288
|
}
|
|
289
|
-
}
|
|
289
|
+
}, "clearBlockTemplates")
|
|
290
290
|
});
|
|
291
291
|
const test = Object.assign(_test, {
|
|
292
292
|
/** 只运行在 postgres 数据库中 */
|
|
@@ -534,20 +534,20 @@ const generateFakerData = /* @__PURE__ */ __name((collectionSetting) => {
|
|
|
534
534
|
var _a;
|
|
535
535
|
const excludeField = ["id", "createdAt", "updatedAt", "createdBy", "updatedBy"];
|
|
536
536
|
const basicInterfaceToData = {
|
|
537
|
-
input: () => import_faker.faker.lorem.words(),
|
|
538
|
-
textarea: () => import_faker.faker.lorem.paragraph(),
|
|
539
|
-
richText: () => import_faker.faker.lorem.paragraph(),
|
|
540
|
-
phone: () => import_faker.faker.phone.number(),
|
|
541
|
-
email: () => import_faker.faker.internet.email(),
|
|
542
|
-
url: () => import_faker.faker.internet.url(),
|
|
543
|
-
integer: () => import_faker.faker.number.int(),
|
|
544
|
-
number: () => import_faker.faker.number.int(),
|
|
545
|
-
percent: () => import_faker.faker.number.float(),
|
|
546
|
-
password: () => import_faker.faker.internet.password(),
|
|
547
|
-
color: () => import_faker.faker.internet.color(),
|
|
548
|
-
icon: () => "checkcircleoutlined",
|
|
549
|
-
datetime: () => import_faker.faker.date.anytime({ refDate: "2023-09-21T00:00:00.000Z" }),
|
|
550
|
-
time: () => "00:00:00"
|
|
537
|
+
input: /* @__PURE__ */ __name(() => import_faker.faker.lorem.words(), "input"),
|
|
538
|
+
textarea: /* @__PURE__ */ __name(() => import_faker.faker.lorem.paragraph(), "textarea"),
|
|
539
|
+
richText: /* @__PURE__ */ __name(() => import_faker.faker.lorem.paragraph(), "richText"),
|
|
540
|
+
phone: /* @__PURE__ */ __name(() => import_faker.faker.phone.number(), "phone"),
|
|
541
|
+
email: /* @__PURE__ */ __name(() => import_faker.faker.internet.email(), "email"),
|
|
542
|
+
url: /* @__PURE__ */ __name(() => import_faker.faker.internet.url(), "url"),
|
|
543
|
+
integer: /* @__PURE__ */ __name(() => import_faker.faker.number.int(), "integer"),
|
|
544
|
+
number: /* @__PURE__ */ __name(() => import_faker.faker.number.int(), "number"),
|
|
545
|
+
percent: /* @__PURE__ */ __name(() => import_faker.faker.number.float(), "percent"),
|
|
546
|
+
password: /* @__PURE__ */ __name(() => import_faker.faker.internet.password(), "password"),
|
|
547
|
+
color: /* @__PURE__ */ __name(() => import_faker.faker.internet.color(), "color"),
|
|
548
|
+
icon: /* @__PURE__ */ __name(() => "checkcircleoutlined", "icon"),
|
|
549
|
+
datetime: /* @__PURE__ */ __name(() => import_faker.faker.date.anytime({ refDate: "2023-09-21T00:00:00.000Z" }), "datetime"),
|
|
550
|
+
time: /* @__PURE__ */ __name(() => "00:00:00", "time")
|
|
551
551
|
};
|
|
552
552
|
const result = {};
|
|
553
553
|
(_a = collectionSetting.fields) == null ? void 0 : _a.forEach((field) => {
|
|
@@ -138,15 +138,15 @@ const _MariaDBClient = class _MariaDBClient extends BaseClient {
|
|
|
138
138
|
__name(_MariaDBClient, "MariaDBClient");
|
|
139
139
|
let MariaDBClient = _MariaDBClient;
|
|
140
140
|
const client = {
|
|
141
|
-
postgres: () => {
|
|
141
|
+
postgres: /* @__PURE__ */ __name(() => {
|
|
142
142
|
return new PostgresClient();
|
|
143
|
-
},
|
|
144
|
-
mysql: () => {
|
|
143
|
+
}, "postgres"),
|
|
144
|
+
mysql: /* @__PURE__ */ __name(() => {
|
|
145
145
|
return new MySQLClient();
|
|
146
|
-
},
|
|
147
|
-
mariadb: () => {
|
|
146
|
+
}, "mysql"),
|
|
147
|
+
mariadb: /* @__PURE__ */ __name(() => {
|
|
148
148
|
return new MariaDBClient();
|
|
149
|
-
}
|
|
149
|
+
}, "mariadb")
|
|
150
150
|
};
|
|
151
151
|
const dialect = process.env["DB_DIALECT"];
|
|
152
152
|
if (!client[dialect]) {
|
package/lib/web/index.js
CHANGED
|
@@ -75,8 +75,7 @@ function getProcessMockData(apis, key) {
|
|
|
75
75
|
}
|
|
76
76
|
return (config) => {
|
|
77
77
|
var _a, _b;
|
|
78
|
-
if (!apis[key])
|
|
79
|
-
return [404, { data: { message: "mock data not found" } }];
|
|
78
|
+
if (!apis[key]) return [404, { data: { message: "mock data not found" } }];
|
|
80
79
|
if (((_a = config == null ? void 0 : config.params) == null ? void 0 : _a.pageSize) || ((_b = config == null ? void 0 : config.params) == null ? void 0 : _b.page)) {
|
|
81
80
|
const { data, meta } = apis[key];
|
|
82
81
|
const pageSize = config.params.pageSize || (meta == null ? void 0 : meta.pageSize) || 20;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/test",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.36-alpha",
|
|
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.2.
|
|
54
|
+
"@nocobase/server": "1.2.36-alpha",
|
|
55
55
|
"@playwright/test": "^1.45.3",
|
|
56
56
|
"@testing-library/jest-dom": "^6.4.2",
|
|
57
57
|
"@testing-library/react": "^14.0.0",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"jsdom-worker": "^0.3.0",
|
|
67
67
|
"mariadb": "^2.5.6",
|
|
68
68
|
"mockjs": "^1.1.0",
|
|
69
|
-
"mysql2": "^
|
|
69
|
+
"mysql2": "^3.11.0",
|
|
70
70
|
"pg": "^8.7.3",
|
|
71
71
|
"pg-hstore": "^2.3.4",
|
|
72
72
|
"sqlite3": "^5.0.8",
|
|
@@ -76,5 +76,5 @@
|
|
|
76
76
|
"vitest-dom": "^0.1.1",
|
|
77
77
|
"ws": "^8.13.0"
|
|
78
78
|
},
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "850d812db1d8e7c0b62b77c6a262ab9faf9e203f"
|
|
80
80
|
}
|