apihub24_token_authentication/test/account.repository.mock.ts

34 lines
934 B
TypeScript

import { DynamicModule, Global, Module } from "@nestjs/common";
import { IAccount } from "../src";
import { IRepository } from "@apihub24/repository";
@Global()
@Module({})
export class AccountRepositoryMockModule {
static forRoot(): DynamicModule {
const providers = [
{
provide: "@apihub24/account_repository",
useClass: AccountRepositoryMock,
},
];
return {
module: AccountRepositoryMockModule,
providers: [...providers],
exports: [...providers],
};
}
}
class AccountRepositoryMock implements IRepository<IAccount> {
getBy(filter: (model: IAccount) => boolean): Promise<IAccount[]> {
throw new Error("Method not implemented.");
}
save(models: IAccount[]): Promise<IAccount[]> {
throw new Error("Method not implemented.");
}
deleteBy(filter: (model: IAccount) => boolean): Promise<boolean> {
throw new Error("Method not implemented.");
}
}