add initial macOS support #40
This commit is contained in:
19
tests/unit/stubs/CategoryCollectionParseContextStub.ts
Normal file
19
tests/unit/stubs/CategoryCollectionParseContextStub.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { ICategoryCollectionParseContext } from '@/application/Parser/Script/ICategoryCollectionParseContext';
|
||||
import { ScriptCompilerStub } from './ScriptCompilerStub';
|
||||
import { LanguageSyntaxStub } from './LanguageSyntaxStub';
|
||||
import { IScriptCompiler } from '@/application/Parser/Script/Compiler/IScriptCompiler';
|
||||
import { ILanguageSyntax } from '@/domain/ScriptCode';
|
||||
|
||||
export class CategoryCollectionParseContextStub implements ICategoryCollectionParseContext {
|
||||
public compiler: IScriptCompiler = new ScriptCompilerStub();
|
||||
public syntax: ILanguageSyntax = new LanguageSyntaxStub();
|
||||
|
||||
public withCompiler(compiler: IScriptCompiler) {
|
||||
this.compiler = compiler;
|
||||
return this;
|
||||
}
|
||||
public withSyntax(syntax: ILanguageSyntax) {
|
||||
this.syntax = syntax;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -30,6 +30,11 @@ export class CategoryCollectionStub implements ICategoryCollection {
|
||||
this.initialScript = script;
|
||||
return this;
|
||||
}
|
||||
public withTotalScripts(totalScripts: number) {
|
||||
this.totalScripts = totalScripts;
|
||||
return this;
|
||||
}
|
||||
|
||||
public findCategory(categoryId: number): ICategory {
|
||||
return this.getAllCategories().find(
|
||||
(category) => category.id === categoryId);
|
||||
|
||||
25
tests/unit/stubs/FunctionDataStub.ts
Normal file
25
tests/unit/stubs/FunctionDataStub.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { FunctionData } from 'js-yaml-loader!*';
|
||||
|
||||
export class FunctionDataStub implements FunctionData {
|
||||
public name = 'function data stub';
|
||||
public code = 'function data stub code';
|
||||
public revertCode = 'function data stub revertCode';
|
||||
public parameters?: readonly string[];
|
||||
|
||||
public withName(name: string) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
public withParameters(...parameters: string[]) {
|
||||
this.parameters = parameters;
|
||||
return this;
|
||||
}
|
||||
public withCode(code: string) {
|
||||
this.code = code;
|
||||
return this;
|
||||
}
|
||||
public withRevertCode(revertCode: string) {
|
||||
this.revertCode = revertCode;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
15
tests/unit/stubs/LanguageSyntaxStub.ts
Normal file
15
tests/unit/stubs/LanguageSyntaxStub.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { ILanguageSyntax } from '@/domain/ScriptCode';
|
||||
|
||||
export class LanguageSyntaxStub implements ILanguageSyntax {
|
||||
public commentDelimiters = [];
|
||||
public commonCodeParts = [];
|
||||
|
||||
public withCommentDelimiters(...delimiters: string[]) {
|
||||
this.commentDelimiters = delimiters;
|
||||
return this;
|
||||
}
|
||||
public withCommonCodeParts(...codeParts: string[]) {
|
||||
this.commonCodeParts = codeParts;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
15
tests/unit/stubs/ScriptCodeStub.ts
Normal file
15
tests/unit/stubs/ScriptCodeStub.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { IScriptCode } from '@/domain/IScriptCode';
|
||||
|
||||
export class ScriptCodeStub implements IScriptCode {
|
||||
public execute = 'default execute code';
|
||||
public revert = 'default revert code';
|
||||
|
||||
public withExecute(code: string) {
|
||||
this.execute = code;
|
||||
return this;
|
||||
}
|
||||
public withRevert(revert: string) {
|
||||
this.revert = revert;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { IScriptCompiler } from '@/application/Parser/Compiler/IScriptCompiler';
|
||||
import { IScriptCompiler } from '@/application/Parser/Script/Compiler/IScriptCompiler';
|
||||
import { IScriptCode } from '@/domain/IScriptCode';
|
||||
import { ScriptData } from 'js-yaml-loader!@/*';
|
||||
|
||||
|
||||
@@ -27,39 +27,30 @@ export class ScriptDataStub implements ScriptData {
|
||||
public recommend = RecommendationLevel[RecommendationLevel.Standard].toLowerCase();
|
||||
public docs = ['hello.com'];
|
||||
|
||||
private constructor() { }
|
||||
|
||||
public withName(name: string): ScriptDataStub {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
public withDocs(docs: string[]): ScriptDataStub {
|
||||
this.docs = docs;
|
||||
return this;
|
||||
}
|
||||
|
||||
public withCode(code: string): ScriptDataStub {
|
||||
this.code = code;
|
||||
return this;
|
||||
}
|
||||
|
||||
public withRevertCode(revertCode: string): ScriptDataStub {
|
||||
this.revertCode = revertCode;
|
||||
return this;
|
||||
}
|
||||
|
||||
public withMockCall(): ScriptDataStub {
|
||||
this.call = { function: 'func', parameters: [] };
|
||||
return this;
|
||||
}
|
||||
|
||||
public withCall(call: ScriptFunctionCallData): ScriptDataStub {
|
||||
this.call = call;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public withRecommend(recommend: string): ScriptDataStub {
|
||||
this.recommend = recommend;
|
||||
return this;
|
||||
|
||||
@@ -15,4 +15,8 @@ export class ScriptingDefinitionStub implements IScriptingDefinition {
|
||||
this.endCode = endCode;
|
||||
return this;
|
||||
}
|
||||
public withLanguage(language: ScriptingLanguage): ScriptingDefinitionStub {
|
||||
this.language = language;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user