add test to ensure correct shared functions are being parsed
This commit is contained in:
21
tests/unit/stubs/CategoryDataStub.ts
Normal file
21
tests/unit/stubs/CategoryDataStub.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { CategoryData, CategoryOrScriptData, DocumentationUrlsData } from 'js-yaml-loader!@/*';
|
||||
import { ScriptDataStub } from './ScriptDataStub';
|
||||
|
||||
export class CategoryDataStub implements CategoryData {
|
||||
public children: readonly CategoryOrScriptData[] = [ ScriptDataStub.createWithCode() ];
|
||||
public category = 'category name';
|
||||
public docs?: DocumentationUrlsData;
|
||||
|
||||
public withChildren(children: readonly CategoryOrScriptData[]) {
|
||||
this.children = children;
|
||||
return this;
|
||||
}
|
||||
public withName(name: string) {
|
||||
this.category = name;
|
||||
return this;
|
||||
}
|
||||
public withDocs(docs: DocumentationUrlsData) {
|
||||
this.docs = docs;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,26 +1,29 @@
|
||||
import { RecommendationLevel } from '@/domain/RecommendationLevel';
|
||||
import { ScriptingLanguage } from '@/domain/ScriptingLanguage';
|
||||
import { CategoryData, ScriptData, CollectionData, ScriptingDefinitionData } from 'js-yaml-loader!@/*';
|
||||
import { CategoryData, ScriptData, CollectionData, ScriptingDefinitionData, FunctionData } from 'js-yaml-loader!@/*';
|
||||
|
||||
export class CollectionDataStub implements CollectionData {
|
||||
public os = 'windows';
|
||||
public actions: readonly CategoryData[] = [ getCategoryStub() ];
|
||||
public scripting: ScriptingDefinitionData = getTestDefinitionStub();
|
||||
public functions?: ReadonlyArray<FunctionData>;
|
||||
|
||||
public withActions(actions: readonly CategoryData[]): CollectionDataStub {
|
||||
this.actions = actions;
|
||||
return this;
|
||||
}
|
||||
|
||||
public withOs(os: string): CollectionDataStub {
|
||||
this.os = os;
|
||||
return this;
|
||||
}
|
||||
|
||||
public withScripting(scripting: ScriptingDefinitionData): CollectionDataStub {
|
||||
this.scripting = scripting;
|
||||
return this;
|
||||
}
|
||||
public withFunctions(functions: ReadonlyArray<FunctionData>) {
|
||||
this.functions = functions;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
export function getCategoryStub(scriptPrefix = 'testScript'): CategoryData {
|
||||
|
||||
@@ -55,4 +55,8 @@ export class ScriptDataStub implements ScriptData {
|
||||
this.recommend = recommend;
|
||||
return this;
|
||||
}
|
||||
public withRecommendationLevel(level: RecommendationLevel): ScriptDataStub {
|
||||
this.recommend = RecommendationLevel[level].toLowerCase();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user