待测试

This commit is contained in:
rain
2026-07-27 17:17:31 +08:00
parent 1eae3bbef4
commit 04287e6777
35 changed files with 4238 additions and 22750 deletions
+13 -5
View File
@@ -44,7 +44,7 @@ const run = async () => {
};
const { appApi } = await import(toDataModuleUrl(`${prelude}\n${moduleBody}`));
const profile = {
userId: 101,
userId: "101",
tenantId: "000000",
userNo: "U-101",
phone: "13800138000",
@@ -52,7 +52,7 @@ const run = async () => {
realName: "王小明",
avatar: 900001,
sex: "男",
birthday: "1990-01-02T00:00:00",
birthday: "1990-01-02",
email: "ming@example.com",
registerSource: "APP",
status: "0",
@@ -66,13 +66,21 @@ const run = async () => {
assert.strictEqual(profileRequest.timeout, 15000);
assert.deepStrictEqual(profileRequest.header, { clientid: "client-1", tenantId: "000000", Authorization: "Bearer session-1" });
const highPrecisionUserId = "9007199254740993";
response = { statusCode: 200, data: { code: 200, data: { ...profile, userId: highPrecisionUserId } } };
assert.strictEqual(
(await appApi.getProfile()).userId,
highPrecisionUserId,
"业务用户 ID 必须保留为精确字符串,不能按头像数值转换",
);
response = { statusCode: 200, data: { code: 200, data: profile } };
await appApi.updateProfile({
nickName: " 新昵称 ",
realName: "王小明",
avatar: 900001,
sex: "女",
birthday: "1991-02-03T00:00:00+08:00",
birthday: "1991-02-03",
email: "new@example.com",
});
assert.deepStrictEqual(requests.at(-1).data, {
@@ -80,12 +88,12 @@ const run = async () => {
realName: "王小明",
avatar: 900001,
sex: "女",
birthday: "1991-02-03T00:00:00+08:00",
birthday: "1991-02-03",
email: "new@example.com",
});
await assert.rejects(appApi.updateProfile({}), /至少需要一个/);
await assert.rejects(appApi.updateProfile({ avatar: Number.MAX_SAFE_INTEGER + 1 }), /安全整数/);
await assert.rejects(appApi.updateProfile({ birthday: "1991-02-03" }), /ISO/);
await assert.rejects(appApi.updateProfile({ birthday: "1991-02-03T00:00:00+08:00" }), /yyyy-MM-dd/);
await assert.rejects(appApi.updateProfile({ email: "bad-email" }), /email/);
response = { statusCode: 200, data: { code: 200, data: { ...profile, avatar: 0 } } };