34 lines
910 B
TypeScript
34 lines
910 B
TypeScript
import { DynamicModule, Global, Module } from "@nestjs/common";
|
|
import { IGroup } from "../src";
|
|
import { IRepository } from "@apihub24/repository";
|
|
|
|
@Global()
|
|
@Module({})
|
|
export class GroupRepositoryMockModule {
|
|
static forRoot(): DynamicModule {
|
|
const providers = [
|
|
{
|
|
provide: "@apihub24/group_repository",
|
|
useClass: GroupRepositoryMock,
|
|
},
|
|
];
|
|
return {
|
|
module: GroupRepositoryMockModule,
|
|
providers: [...providers],
|
|
exports: [...providers],
|
|
};
|
|
}
|
|
}
|
|
|
|
class GroupRepositoryMock implements IRepository<IGroup> {
|
|
getBy(filter: (model: IGroup) => boolean): Promise<IGroup[]> {
|
|
throw new Error("Method not implemented.");
|
|
}
|
|
save(models: IGroup[]): Promise<IGroup[]> {
|
|
throw new Error("Method not implemented.");
|
|
}
|
|
deleteBy(filter: (model: IGroup) => boolean): Promise<boolean> {
|
|
throw new Error("Method not implemented.");
|
|
}
|
|
}
|