test(sites): assert current userbar traffic in account history
This commit is contained in:
1 parent
55841402a6
commit
487046ae8d
1 file changed
+4
-3
@@ -74,7 +74,8 @@ describe.skipIf(!up)("站点中心(mock NexusPHP)", () => {
|
||||
expect(res.userData).toMatchObject({
|
||||
username: "mockuser",
|
||||
userLevel: "Elite User",
|
||||
upload: 12.5 * TiB,
|
||||
// 当前用户栏为2TB;通用info_block的12.5TB不能覆盖明确的用户栏数据。
|
||||
upload: 2 * TiB,
|
||||
ratio: 20.48,
|
||||
seeding: 31,
|
||||
vip: null,
|
||||
@@ -92,7 +93,7 @@ describe.skipIf(!up)("站点中心(mock NexusPHP)", () => {
|
||||
expect(acc.login_name).toBe("alice");
|
||||
const hist = await json(await h.req(`/sites/${siteId}/user-data?days=30`));
|
||||
expect(hist.items).toHaveLength(1);
|
||||
expect(hist.items[0]).toMatchObject({ siteAccountId: acc.id, upload: 12.5 * TiB, seeding: 31 });
|
||||
expect(hist.items[0]).toMatchObject({ siteAccountId: acc.id, upload: 2 * TiB, seeding: 31 });
|
||||
// 同日再刷新:upsert 不新增行
|
||||
await refresh();
|
||||
expect((await json(await h.req(`/sites/${siteId}/user-data`))).items).toHaveLength(1);
|
||||
@@ -101,7 +102,7 @@ describe.skipIf(!up)("站点中心(mock NexusPHP)", () => {
|
||||
const item = list.items.find((s: { id: string }) => s.id === siteId);
|
||||
expect(item.accountStatus).toBe("active");
|
||||
expect(item.accounts[0]).toMatchObject({ hasSession: true, hasTotp: false, loginName: "alice", status: "active" });
|
||||
expect(item.accounts[0].userData.upload).toBe(12.5 * TiB);
|
||||
expect(item.accounts[0].userData.upload).toBe(2 * TiB);
|
||||
expect(JSON.stringify(list)).not.toMatch(/sessionSecretRef|s3cret-pw|mock-session-secret/);
|
||||
// 会话 Cookie 给适配器用
|
||||
const page = await h.rt
|
||||
|
||||
Reference in new issue
Block a user