MAESTRO: default DNS toggle off

This commit is contained in:
Mariusz Banach
2026-02-18 01:25:02 +01:00
parent 9f860a6f86
commit 196689f041
3 changed files with 13 additions and 7 deletions

View File

@@ -96,11 +96,8 @@ afterEach(() => {
describe("AnalysisControls", () => {
it("renders toggles with default off state", async () => {
setupFetchMock(sampleTests);
const config: AnalysisConfig = { testIds: [], resolve: false, decodeAll: false };
const { container } = render(
<AnalysisControls config={config} onChange={() => undefined} />,
);
const { container } = render(<AnalysisControls onChange={() => undefined} />);
await act(async () => {
await flushPromises();

View File

@@ -13,10 +13,16 @@ import type { AnalysisConfig } from "../types/analysis";
import TestSelector from "./TestSelector";
type AnalysisControlsProps = {
config: AnalysisConfig;
config?: AnalysisConfig;
onChange: (next: AnalysisConfig) => void;
};
const defaultConfig: AnalysisConfig = {
testIds: [],
resolve: false,
decodeAll: false,
};
const handleToggleKeyDown = (
event: KeyboardEvent<HTMLButtonElement>,
onToggle: () => void,
@@ -27,7 +33,10 @@ const handleToggleKeyDown = (
}
};
export default function AnalysisControls({ config, onChange }: AnalysisControlsProps) {
export default function AnalysisControls({
config = defaultConfig,
onChange,
}: AnalysisControlsProps) {
const updateTests = (nextTestIds: number[]) => {
onChange({ ...config, testIds: nextTestIds });
};