diff --git a/src/modules/pwned/pwned.service.spec.ts b/src/modules/pwned/pwned.service.spec.ts new file mode 100644 index 000000000..a422fdb9a --- /dev/null +++ b/src/modules/pwned/pwned.service.spec.ts @@ -0,0 +1,18 @@ +import { PwnedService } from './pwned.service'; + +const pwnedService = new PwnedService(); + +describe('PwnedService', () => { + describe('isPasswordSafe', () => { + it('unsafe password', async () => { + const safe = await pwnedService.isPasswordSafe('password123'); + expect(safe).toBeFalsy(); + }); + it('safe password', async () => { + const safe = await pwnedService.isPasswordSafe( + Math.random().toString(36).slice(2), + ); + expect(safe).toBeTruthy(); + }); + }); +});