mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
add tests
This commit is contained in:
1 parent
081a75af8c
commit
54a57d3ca9
8 files changed
+27
-16
No files matched your search
@@ -0,0 +1,14 @@
|
||||
import 'hydrooj';
|
||||
import pwhash from 'hydrooj/src/lib/hash.hydro';
|
||||
import 'hydrooj/src/utils';
|
||||
|
||||
describe('Hash', () => {
|
||||
test('server', () => {
|
||||
const password1 = 'password1';
|
||||
const salt1 = '0326Bc23E6fac733K01g29fBBUSAj7O4';
|
||||
const salt2 = String.random(32);
|
||||
const hash1 = '70a2db6a53ecd75d8d4b19d8647a416b4e812c1a6635c4a1f5069a00382fdcb6';
|
||||
expect(pwhash(password1, salt1)).toStrictEqual(hash1);
|
||||
expect(pwhash(password1, salt2)).not.toEqual(hash1);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user