Files
creator-hub/web/tests/account-management-list.test.cjs
T
rogee c6a4d20c03
douyin-release-gate / verify (push) Failing after 4m12s
feat(accounts): 我的账号列表展示画像指标并新增「启动」操作
- 列表新增粉丝/关注/获赞/互关/评论数值列(formatCount 风格对齐监控列表),作品数据列作品数取最新快照回填
- 操作列新增「启动」:POST /phase-a/accounts/:id/start 启动环境,成功后弹窗展示网关浏览器登录画面
  (login-qr 截图,默认打开个人中心页),支持刷新画面与核验浏览器身份;409 就绪原因透传提示
- 详情页趋势图与账号数据卡补互关序列
- 新增源码断言测试 account-management-list.test.cjs(4 用例全过,antd lint 0 警告)
2026-09-30 12:50:19 +08:00

52 lines
1.9 KiB
JavaScript

const assert = require('node:assert/strict');
const { readFileSync } = require('node:fs');
const { test } = require('node:test');
const ts = require('typescript');
const source = ts.createSourceFile(
'AccountManagementList.tsx',
readFileSync(`${__dirname}/../src/components/accounts/AccountManagementList.tsx`, 'utf8'),
ts.ScriptTarget.Latest,
true,
ts.ScriptKind.TSX,
);
const code = source.getFullText();
test('列表展示粉丝、关注、获赞、互关、评论独立数值列', () => {
for (const [title, value] of [
['粉丝', 'account.follower_count'],
['关注', 'account.following_count'],
['获赞', 'account.total_favorited'],
['互关', 'account.friend_count'],
['评论', 'account.comment_total'],
]) {
assert.ok(
code.includes(`title: '${title}',\n render: (_, account) => formatCount(${value}),`),
`${title} 应为独立数值列`,
);
}
});
test('操作列包含「启动」:先启动环境再弹出登录画面', () => {
assert.match(code, /onClick=\{\(\) => startAccount\(account\)\}/);
assert.match(code, /\/phase-a\/accounts\/\$\{encodeURIComponent\(row\.id\)\}\/start/);
assert.match(code, /setLoginTarget\(row\)/);
assert.match(code, /requestLoginQR\(row\)/);
});
test('登录弹窗复用 login-qr 截图并支持刷新与核验', () => {
assert.match(code, /\/creator\/accounts\/\$\{encodeURIComponent\(target\.id\)\}\/login-qr/);
assert.match(code, /\/creator\/accounts\/\$\{encodeURIComponent\(loginTarget\.id\)\}\/verify/);
assert.match(code, /刷新登录画面/);
assert.match(code, /核验浏览器身份/);
assert.match(code, /image_base64/);
});
test('启动失败走 conflictMessage 透传 409 就绪原因', () => {
assert.ok(
code.includes(
"messageApi.error(conflictMessage(startError, '启动未完成:账号或环境不满足就绪条件,请按不可运行原因处理后重试。'));",
),
);
});