fix(import): name a source after its subfolder, read-only (#426) #441
1 changed files with 44 additions and 0 deletions
44
src/components/import/SourceConfigPanel.test.tsx
Normal file
44
src/components/import/SourceConfigPanel.test.tsx
Normal 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");
|
||||
});
|
||||
});
|
||||
Loading…
Reference in a new issue