Files
privacy.sexy/tests/unit/stubs/CategoryStub.ts
2020-01-06 20:02:12 +01:00

27 lines
913 B
TypeScript

import { ScriptStub } from './ScriptStub';
import { BaseEntity } from '@/infrastructure/Entity/BaseEntity';
import { ICategory, IScript } from '@/domain/ICategory';
export class CategoryStub extends BaseEntity<number> implements ICategory {
public readonly name = `category-with-id-${this.id}`;
public readonly subCategories = new Array<ICategory>();
public readonly scripts = new Array<IScript>();
public readonly documentationUrls = new Array<string>();
constructor(id: number) {
super(id);
}
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;
}
}