import {hashIp} from '../../src/models/feedback/feedback.ratelimit'; describe('hashIp', () => { it('never returns the raw IP', () => { const hash = hashIp('203.0.113.42'); expect(hash).not.toContain('203.0.113.42'); }); it('is deterministic for the same input', () => { expect(hashIp('203.0.113.42')).toBe(hashIp('203.0.113.42')); }); it('differs for different inputs', () => { expect(hashIp('203.0.113.42')).not.toBe(hashIp('203.0.113.43')); }); it('is a 64-char hex SHA-256 digest', () => { expect(hashIp('203.0.113.42')).toMatch(/^[0-9a-f]{64}$/); }); });