* feat(attachments): support local files and video attachments Share gateway inspection and send validation for borrowed local paths while preserving binary uploads, original-file ownership, and existing limits. Related to NAN-284. Native provider video input remains outside this change. * test: make cross-platform verification fixtures self-contained * test(webui): align typed fixtures with runtime contracts * fix(webui): preserve uploaded video playback during history sync * test(tui): preserve local attachment drafts across resizes * perf(attachments): preserve upload caches and release video previews * docs(webui): keep attachment guidance user-focused * chore: remove redundant dependency comment * test(providers): make stream idle renewal timing deterministic * fix(attachments): keep upload byte limits out of local references Validate common format/count rules separately from upload byte budgets. Keep local inspection and send-time checks metadata-only, and exclude local references from composer and pending-upload totals. Explain upload size rejections with actual size and maximum in all ten locales. Related to NAN-284. * fix(attachments): retain image references and draft order * fix(attachments): close local reference UX and authorization gaps * fix(attachments): preserve focus during asynchronous path confirmation
66 lines
2.1 KiB
TypeScript
66 lines
2.1 KiB
TypeScript
import { act, cleanup, fireEvent, render, screen, within } from "@testing-library/react";
|
|
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
|
|
import { AutomationsSettings } from "@/components/settings/system/AutomationsSettings";
|
|
import i18n from "@/i18n";
|
|
|
|
afterEach(cleanup);
|
|
|
|
function renderAutomationDetail(channel: string) {
|
|
render(
|
|
<AutomationsSettings
|
|
payload={{ jobs: [{
|
|
id: "task-1",
|
|
name: "Scheduled task",
|
|
enabled: true,
|
|
schedule: { kind: "every", every_ms: 60_000 },
|
|
payload: { message: "Summarize updates" },
|
|
state: { next_run_at_ms: Date.now() + 60_000 },
|
|
origin: { channel },
|
|
}] }}
|
|
loading={false}
|
|
filter="all"
|
|
actionKey={null}
|
|
error={null}
|
|
onFilterChange={vi.fn()}
|
|
onAction={vi.fn()}
|
|
onRequestEdit={vi.fn()}
|
|
onRequestDelete={vi.fn()}
|
|
/>,
|
|
);
|
|
fireEvent.click(screen.getByRole("button", { name: /Scheduled task/ }));
|
|
return within(screen.getByRole("dialog", { name: "Scheduled task" }));
|
|
}
|
|
|
|
describe("automation channel identity", () => {
|
|
it("uses channel-owned names in the detail when the language changes", async () => {
|
|
const detail = renderAutomationDetail("email");
|
|
expect(detail.getByText("Email")).toBeVisible();
|
|
|
|
for (const [locale, name] of [
|
|
["zh-CN", "电子邮件"],
|
|
["ja", "メール"],
|
|
["es", "Correo electrónico"],
|
|
]) {
|
|
await act(async () => { await i18n.changeLanguage(locale); });
|
|
expect(detail.getByText(name)).toBeVisible();
|
|
expect(detail.queryByText("Email")).not.toBeInTheDocument();
|
|
}
|
|
});
|
|
|
|
it("resolves aliases through the owning channel namespace", async () => {
|
|
await i18n.changeLanguage("zh-CN");
|
|
const detail = renderAutomationDetail("wechat");
|
|
expect(detail.getByText("微信")).toBeVisible();
|
|
});
|
|
|
|
it.each([
|
|
["api", "API"],
|
|
["cli", "CLI"],
|
|
["extension-chat", "extension-chat"],
|
|
])("preserves the label for %s", (channel, label) => {
|
|
const detail = renderAutomationDetail(channel);
|
|
expect(detail.getByText(label)).toBeVisible();
|
|
});
|
|
});
|