15 lines
524 B
TypeScript
15 lines
524 B
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { InMemoryPasswordHashingService } from './InMemoryPasswordHashingService';
|
|
|
|
describe('InMemoryPasswordHashingService', () => {
|
|
it('hashes and verifies deterministically', async () => {
|
|
const service = new InMemoryPasswordHashingService();
|
|
|
|
const hash = await service.hash('secret');
|
|
expect(hash).toBe('demo_salt_terces');
|
|
|
|
expect(await service.verify('secret', hash)).toBe(true);
|
|
expect(await service.verify('wrong', hash)).toBe(false);
|
|
});
|
|
});
|