default selection is now none

This commit is contained in:
undergroundwires
2020-01-06 20:02:12 +01:00
parent 20020af7c1
commit 3140cc663b
21 changed files with 295 additions and 237 deletions

View File

@@ -1,6 +1,10 @@
import { IApplication, ICategory, IScript } from '@/domain/IApplication';
export class ApplicationStub implements IApplication {
public readonly totalScripts = 0;
public readonly totalCategories = 0;
public readonly name = 'StubApplication';
public readonly version = 1;
public readonly categories = new Array<ICategory>();
public withCategory(category: ICategory): IApplication {
@@ -10,11 +14,12 @@ export class ApplicationStub implements IApplication {
public findCategory(categoryId: number): ICategory {
throw new Error('Method not implemented.');
}
public getRecommendedScripts(): readonly IScript[] {
throw new Error('Method not implemented.');
}
public findScript(scriptId: string): IScript {
throw new Error('Method not implemented.');
}
public getAllScripts(): ReadonlyArray<IScript> {
throw new Error('Method not implemented.');
}

View File

@@ -11,10 +11,16 @@ export class CategoryStub extends BaseEntity<number> implements ICategory {
constructor(id: number) {
super(id);
}
public withScripts(...scriptIds: string[]): CategoryStub {
public withScriptIds(...scriptIds: string[]): CategoryStub {
for (const scriptId of scriptIds) {
this.scripts.push(new ScriptStub(scriptId));
}
return this;
}
public withScripts(...scripts: IScript[]): CategoryStub {
for (const script of scripts) {
this.scripts.push(script);
}
return this;
}
}

View File

@@ -5,8 +5,14 @@ export class ScriptStub extends BaseEntity<string> implements IScript {
public readonly name = `name${this.id}`;
public readonly code = `name${this.id}`;
public readonly documentationUrls = new Array<string>();
public isRecommended = false;
constructor(public readonly id: string) {
super(id);
}
public withIsRecommended(value: boolean): ScriptStub {
this.isRecommended = value;
return this;
}
}