fix(import): name a source after its subfolder, read-only (#426) #441

Merged
maximus merged 3 commits from issue-426-source-name-folder into main 2026-10-16 00:37:20 +00:00
Showing only changes of commit 00b4319c44 - Show all commits

View file

@ -0,0 +1,44 @@
// SourceConfigPanel — the source name is read-only, the subfolder's (#426).
// No jsdom: rendered to static markup with the shared marked `t`.
import { describe, it, expect, vi } from "vitest";
import { renderToStaticMarkup } from "react-dom/server";
vi.mock("react-i18next", async () => (await import("../../test/i18nMock")).i18nMock());
import SourceConfigPanel from "./SourceConfigPanel";
import { initialWizardState } from "../../hooks/useImportWizard";
const noop = () => undefined;
const render = () =>
renderToStaticMarkup(
<SourceConfigPanel
source={{ folder_name: "Desjardins", folder_path: "/releves/Desjardins", files: [] }}
config={{ ...initialWizardState.sourceConfig, name: "Mon compte chèques" }}
selectedFiles={[]}
headers={[]}
configTemplates={[]}
onConfigChange={noop}
onFileToggle={noop}
onSelectAllFiles={noop}
onAutoDetect={noop}
onSaveAsTemplate={noop}
onApplyTemplate={noop}
onUpdateTemplate={noop}
onDeleteTemplate={noop}
selectedTemplateId={null}
/>,
);
describe("SourceConfigPanel — source name (#426)", () => {
it("shows the subfolder name with its hint", () => {
const html = render();
expect(html).toContain("t(import.config.sourceNameHint)");
expect(html).toMatch(/<p[^>]*>Desjardins<\/p>/);
});
it("has no field holding the configured name", () => {
const html = render();
expect(html).not.toContain("Mon compte chèques");
});
});