This commit is contained in:
17
tests/unit/stubs/CodeSubstituterStub.ts
Normal file
17
tests/unit/stubs/CodeSubstituterStub.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { IProjectInformation } from '@/domain/IProjectInformation';
|
||||
import { ICodeSubstituter } from '@/application/Parser/ScriptingDefinition/ICodeSubstituter';
|
||||
|
||||
export class CodeSubstituterStub implements ICodeSubstituter {
|
||||
private readonly scenarios = new Array<{ code: string, info: IProjectInformation, result: string}>();
|
||||
public substitute(code: string, info: IProjectInformation): string {
|
||||
const scenario = this.scenarios.find((s) => s.code === code && s.info === info);
|
||||
if (scenario) {
|
||||
return scenario.result;
|
||||
}
|
||||
return `[CodeSubstituterStub] - code: ${code}`;
|
||||
}
|
||||
public setup( code: string, info: IProjectInformation, result: string) {
|
||||
this.scenarios.push({ code, info, result});
|
||||
return this;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user