diff --git a/package-lock.json b/package-lock.json index f8cf545..25e0b03 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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", diff --git a/package.json b/package.json index be9aa61..db30959 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/password.hash.service.spec.ts b/src/password.hash.service.spec.ts index beb537d..042e276 100644 --- a/src/password.hash.service.spec.ts +++ b/src/password.hash.service.spec.ts @@ -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; diff --git a/src/password.hasher.module.spec.ts b/src/password.hasher.module.spec.ts index 37ddace..d4de461 100644 --- a/src/password.hasher.module.spec.ts +++ b/src/password.hasher.module.spec.ts @@ -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"); diff --git a/src/password.hasher.module.ts b/src/password.hasher.module.ts index 787f6d0..c494949 100644 --- a/src/password.hasher.module.ts +++ b/src/password.hasher.module.ts @@ -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, }, ];