This commit is contained in:
admin 2025-08-21 20:59:04 +02:00
parent 7eae722041
commit 5ae916bad4
5 changed files with 19 additions and 9 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "@apihub24/password-hasher",
"version": "1.0.4",
"version": "1.0.5",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@apihub24/password-hasher",
"version": "1.0.4",
"version": "1.0.5",
"license": "MIT",
"dependencies": {
"@apihub24/token-authentication": "^1.0.0",

View File

@ -1,6 +1,6 @@
{
"name": "@apihub24/password-hasher",
"version": "1.0.4",
"version": "1.0.5",
"description": "",
"main": "dist/index.js",
"types": "./dist/index.d.ts",

View File

@ -1,6 +1,6 @@
import { ConfigModule } from "@nestjs/config";
import { Test, TestingModule } from "@nestjs/testing";
import { PasswordHashService } from "./password.hash.service";
import { PasswordHashService } from "./";
describe("Password Service Tests", () => {
let module: TestingModule | null = null;

View File

@ -1,5 +1,8 @@
import { Test, TestingModule } from "@nestjs/testing";
import { PasswordHasherModule } from "./password.hasher.module";
import {
APIHUB24_PASSWORD_SERVICE_INJECTION_KEY,
PasswordHasherModule,
} from "./";
describe("PasswordHasherModule Tests", () => {
let module: TestingModule | null = null;
@ -10,6 +13,10 @@ describe("PasswordHasherModule Tests", () => {
}).compile();
});
it("should export injection Key", () => {
expect(APIHUB24_PASSWORD_SERVICE_INJECTION_KEY).toBeDefined();
});
it("should get PasswordHasherService by injection Key @apihub24/password_service", () => {
expect(module).toBeDefined();
const service = module?.get("@apihub24/password_service");

View File

@ -1,13 +1,16 @@
import { DynamicModule, Module } from '@nestjs/common';
import { PasswordHashService } from './password.hash.service';
import { ConfigModule } from '@nestjs/config';
import { DynamicModule, Module } from "@nestjs/common";
import { PasswordHashService } from "./password.hash.service";
import { ConfigModule } from "@nestjs/config";
export const APIHUB24_PASSWORD_SERVICE_INJECTION_KEY =
"@apihub24/password_service";
@Module({})
export class PasswordHasherModule {
static forRoot(): DynamicModule {
const providers = [
{
provide: '@apihub24/password_service',
provide: APIHUB24_PASSWORD_SERVICE_INJECTION_KEY,
useClass: PasswordHashService,
},
];