- Use better error messages with more context. - Unify their validation logic and share tests. - Validate also type of the name. - Refactor node (Script/Category) parser tests for easier future changes and cleaner test code (using `TestBuilder` to do dirty work in unified way). - Add more tests. Custom `Error` properties are compared manually due to `chai` not supporting deep equality checks (chaijs/chai#1065, chaijs/chai#1405).
13 lines
526 B
TypeScript
13 lines
526 B
TypeScript
import { NodeData } from '@/application/Parser/NodeValidation/NodeData';
|
|
import { INodeDataErrorContext } from '@/application/Parser/NodeValidation/NodeDataError';
|
|
import { NodeType } from '@/application/Parser/NodeValidation/NodeType';
|
|
import { CategoryDataStub } from './CategoryDataStub';
|
|
|
|
export class NodeDataErrorContextStub implements INodeDataErrorContext {
|
|
public readonly type: NodeType = NodeType.Script;
|
|
|
|
public readonly selfNode: NodeData = new CategoryDataStub();
|
|
|
|
public readonly parentNode?: NodeData;
|
|
}
|