test: added tests for editorwarnings

ref: N25B-450
This commit is contained in:
JGerla
2026-01-22 13:31:02 +01:00
parent 9d2f5127c1
commit 9f359de953
2 changed files with 186 additions and 23 deletions

View File

@@ -3,7 +3,6 @@ import { cleanup } from '@testing-library/react';
import {
type CompositeWarningKey,
type SeverityIndex,
type WarningRegistry
} from "../src/pages/VisProgPage/visualProgrammingUI/components/EditorWarnings.tsx";
import useFlowStore from '../src/pages/VisProgPage/visualProgrammingUI/VisProgStores.tsx';
@@ -74,33 +73,41 @@ export const mockReactFlow = () => {
};
const emptySeverityIndex : SeverityIndex = new Map([
['INFO', new Set<CompositeWarningKey>()],
['WARNING', new Set<CompositeWarningKey>()],
['ERROR', new Set<CompositeWarningKey>()],
]);
const emptyWarningRegistry : WarningRegistry = new Map();
const defaultState = {
nodes: [],
edges: [],
past: [],
future: [],
isBatchAction: false,
edgeReconnectSuccessful: true,
ruleRegistry: new Map(),
editorWarningRegistry: emptyWarningRegistry,
severityIndex: emptySeverityIndex,
}
beforeAll(() => {
useFlowStore.setState(defaultState);
useFlowStore.setState({
nodes: [],
edges: [],
past: [],
future: [],
isBatchAction: false,
edgeReconnectSuccessful: true,
ruleRegistry: new Map(),
editorWarningRegistry: new Map(),
severityIndex: new Map([
['INFO', new Set<CompositeWarningKey>()],
['WARNING', new Set<CompositeWarningKey>()],
['ERROR', new Set<CompositeWarningKey>()],
]) as SeverityIndex,
});
});
afterEach(() => {
cleanup();
useFlowStore.setState(defaultState);
useFlowStore.setState({
nodes: [],
edges: [],
past: [],
future: [],
isBatchAction: false,
edgeReconnectSuccessful: true,
ruleRegistry: new Map(),
editorWarningRegistry: new Map(),
severityIndex: new Map([
['INFO', new Set<CompositeWarningKey>()],
['WARNING', new Set<CompositeWarningKey>()],
['ERROR', new Set<CompositeWarningKey>()],
]) as SeverityIndex,
});
});
if (typeof HTMLDialogElement !== 'undefined') {