import assert from "node:assert/strict"; import { readFileSync } from "node:fs"; import test from "node:test"; const source = readFileSync(new URL("./SettingsFileAssociationsTab.tsx", import.meta.url), "utf8"); test("SFTP settings imports the shared Toggle used by its option rows", () => { assert.match(source, / { assert.match(source, /import \{ ConfirmDialog \} from "\.\.\/\.\.\/ui\/confirm-dialog";/); assert.doesNotMatch(source, /window\.confirm|globalThis\.confirm|\bconfirm\(/); assert.match( source, /const \[removeConfirmExt, setRemoveConfirmExt\] = useState\(null\);/, ); const handleRemove = functionBody("handleRemove"); assert.match(handleRemove, /setRemoveConfirmExt\(extension\)/); assert.doesNotMatch(handleRemove, /removeAssociation\(/); const handleConfirm = functionBody("handleConfirmRemove"); assert.match(handleConfirm, /if \(!removeConfirmExt\) return;/); assert.match(handleConfirm, /removeAssociation\(removeConfirmExt\);\s*setRemoveConfirmExt\(null\);/); const dialogStart = source.indexOf("