26 lines
657 B
TypeScript
26 lines
657 B
TypeScript
import { DynamicModule, Global, Module } from "@nestjs/common";
|
|
import { IRepository } from "@apihub24/repository";
|
|
import { APIHUB24_GROUP_REPOSITORY, IGroup } from "@apihub24/authentication";
|
|
|
|
@Global()
|
|
@Module({})
|
|
export class GroupRepositoryMockModule {
|
|
static forRoot(): DynamicModule {
|
|
const providers = [
|
|
{
|
|
provide: APIHUB24_GROUP_REPOSITORY,
|
|
useValue: {
|
|
deleteBy: jest.fn(),
|
|
getBy: jest.fn(),
|
|
save: jest.fn(),
|
|
} as IRepository<IGroup>,
|
|
},
|
|
];
|
|
return {
|
|
module: GroupRepositoryMockModule,
|
|
providers: [...providers],
|
|
exports: [...providers],
|
|
};
|
|
}
|
|
}
|