Refactor to unify scripts/categories as Executable
This commit consolidates scripts and categories under a unified 'Executable' concept. This simplifies the architecture and improves code readability. - Introduce subfolders within `src/domain` to segregate domain elements. - Update class and interface names by removing the 'I' prefix in alignment with new coding standards. - Replace 'Node' with 'Executable' to clarify usage; reserve 'Node' exclusively for the UI's tree component.
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
export interface DataValidationTestScenario<T> {
|
||||
readonly description: string;
|
||||
readonly data: T;
|
||||
readonly expectedPass: boolean;
|
||||
readonly expectedMessage?: string;
|
||||
}
|
||||
|
||||
export function generateDataValidationTestScenarios<T>(
|
||||
...conditionBasedScenarios: DataValidationConditionBasedTestScenario<T>[]
|
||||
): DataValidationTestScenario<T>[] {
|
||||
return conditionBasedScenarios.flatMap((conditionScenario) => [
|
||||
conditionScenario.expectFail.map((failDefinition): DataValidationTestScenario<T> => ({
|
||||
description: `fails: "${failDefinition.description}"`,
|
||||
data: failDefinition.data,
|
||||
expectedPass: false,
|
||||
expectedMessage: conditionScenario.assertErrorMessage,
|
||||
})),
|
||||
conditionScenario.expectPass.map((passDefinition): DataValidationTestScenario<T> => ({
|
||||
description: `passes: "${passDefinition.description}"`,
|
||||
data: passDefinition.data,
|
||||
expectedPass: true,
|
||||
expectedMessage: conditionScenario.assertErrorMessage,
|
||||
})),
|
||||
].flat());
|
||||
}
|
||||
|
||||
interface DataValidationConditionBasedTestScenario<T> {
|
||||
readonly assertErrorMessage?: string;
|
||||
readonly expectPass: readonly DataValidationScenarioDefinition<T>[];
|
||||
readonly expectFail: readonly DataValidationScenarioDefinition<T>[];
|
||||
}
|
||||
|
||||
interface DataValidationScenarioDefinition<T> {
|
||||
readonly description: string;
|
||||
readonly data: T;
|
||||
}
|
||||
Reference in New Issue
Block a user