Initial commit
This commit is contained in:
21
tests/unit/stubs/ApplicationStub.ts
Normal file
21
tests/unit/stubs/ApplicationStub.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { IApplication, ICategory, IScript } from '@/domain/IApplication';
|
||||
|
||||
export class ApplicationStub implements IApplication {
|
||||
public readonly categories = new Array<ICategory>();
|
||||
|
||||
public withCategory(category: ICategory): IApplication {
|
||||
this.categories.push(category);
|
||||
return this;
|
||||
}
|
||||
public findCategory(categoryId: number): ICategory {
|
||||
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.');
|
||||
}
|
||||
}
|
||||
20
tests/unit/stubs/CategoryStub.ts
Normal file
20
tests/unit/stubs/CategoryStub.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
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 withScripts(...scriptIds: string[]): CategoryStub {
|
||||
for (const scriptId of scriptIds) {
|
||||
this.scripts.push(new ScriptStub(scriptId));
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
7
tests/unit/stubs/NumericEntityStub.ts
Normal file
7
tests/unit/stubs/NumericEntityStub.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { BaseEntity } from '@/infrastructure/Entity/BaseEntity';
|
||||
|
||||
export class NumericEntityStub extends BaseEntity<number> {
|
||||
constructor(id: number) {
|
||||
super(id);
|
||||
}
|
||||
}
|
||||
12
tests/unit/stubs/ScriptStub.ts
Normal file
12
tests/unit/stubs/ScriptStub.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { BaseEntity } from '@/infrastructure/Entity/BaseEntity';
|
||||
import { IScript } from './../../../src/domain/IScript';
|
||||
|
||||
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>();
|
||||
|
||||
constructor(public readonly id: string) {
|
||||
super(id);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user