feat: integrate creator hub douyin workflows

This commit is contained in:
2026-09-14 19:22:07 +08:00
parent 025fe62c37
commit 44a28954cf
42 changed files with 2850 additions and 880 deletions
+57
View File
@@ -180,6 +180,29 @@ describe("creator pages", () => {
expect(await screen.findByText("暂无符合条件的作品。")).toBeTruthy();
});
it("requires preview confirmation before importing a competitor", async () => {
const dataProvider = provider();
renderPage(<CreatorCompetitorsPage />, dataProvider);
fireEvent.change(screen.getByLabelText("主页 URL", { exact: false }), {
target: { value: "https://www.douyin.com/user/sec-b" },
});
fireEvent.click(screen.getByRole("button", { name: "解析链接预览" }));
expect(await screen.findByText("导入预览")).toBeTruthy();
expect(dataProvider.create).not.toHaveBeenCalled();
fireEvent.click(screen.getByRole("button", { name: "确认预览内容" }));
fireEvent.click(screen.getByRole("button", { name: "加入监测" }));
await waitFor(() => expect(dataProvider.create).toHaveBeenCalled());
expect(dataProvider.create).toHaveBeenCalledWith(
expect.objectContaining({
resource: "creator-competitors",
variables: expect.objectContaining({
platform: "douyin",
platform_account_key: "sec-b",
}),
}),
);
});
it("keeps account password out of the returned profile and exposes big-account action", async () => {
const dataProvider = provider();
renderPage(<CreatorAccountsPage />, dataProvider);
@@ -230,6 +253,40 @@ describe("creator pages", () => {
expect(screen.getByRole("option", { name: "小红书账号" })).toBeTruthy();
});
it("shows the private-message business update connection state", async () => {
const creatorSubscribe = vi.fn(() => new Promise(() => {}));
const conversation = {
id: "conversation-a",
account_id: profile.id,
platform: profile.platform,
peer_uid: "peer-a",
peer_name: "客户",
};
const dataProvider = provider({
creatorSubscribe,
getList: vi.fn(({ resource }) =>
Promise.resolve({
data:
resource === "creator-accounts"
? [profile]
: resource === "creator-conversations"
? [conversation]
: [],
total: resource === "creator-conversations" ? 1 : 0,
}),
),
});
renderPage(<CreatorWorkbenchPage />, dataProvider);
fireEvent.click(await screen.findByRole("tab", { name: "私信" }));
expect(await screen.findByText("后台更新连接中")).toBeTruthy();
expect(creatorSubscribe).toHaveBeenCalledWith(
"/creator/updates",
expect.any(Function),
expect.any(AbortSignal),
expect.any(Function),
);
});
it("isolates private messages by account and confirms one durable send", async () => {
const conversation = {
id: "conversation-a",