Add Feedback domain module: public submission flow, admin CRUD, reporting (#7)
Jenkins Production Deployment
Jenkins Production Deployment
Co-authored-by: Patrick Müller <mail@pmueller.me> Reviewed-on: #7 Co-authored-by: Patrick Mueller <patrick@mueller-patrick.tech> Co-committed-by: Patrick Mueller <patrick@mueller-patrick.tech>
This commit was merged in pull request #7.
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
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}$/);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user