35 lines
903 B
TypeScript
35 lines
903 B
TypeScript
import { DynamicModule, Global, Module } from "@nestjs/common";
|
|
import { Algorithm, IAccount, ISession, ITokenService } from "../src";
|
|
|
|
@Global()
|
|
@Module({})
|
|
export class TokenServiceMockModule {
|
|
static forRoot(): DynamicModule {
|
|
const providers = [
|
|
{ provide: "@apihub24/token_service", useClass: TokenServiceMock },
|
|
];
|
|
return {
|
|
module: TokenServiceMockModule,
|
|
providers: [...providers],
|
|
exports: [...providers],
|
|
};
|
|
}
|
|
}
|
|
|
|
class TokenServiceMock implements ITokenService {
|
|
generate(
|
|
session: ISession,
|
|
subject: string,
|
|
expires?: string,
|
|
algorithm?: Algorithm
|
|
): Promise<string> {
|
|
throw new Error("Method not implemented.");
|
|
}
|
|
validate(token: string): Promise<boolean> {
|
|
throw new Error("Method not implemented.");
|
|
}
|
|
getAccount(token: string): Promise<IAccount | null> {
|
|
throw new Error("Method not implemented.");
|
|
}
|
|
}
|