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