diff --git a/test/index.js b/test/index.js index c56ef71..2f0985f 100644 --- a/test/index.js +++ b/test/index.js @@ -29,6 +29,13 @@ test ('random_hex should refuse lenght smaller 1', (t) => { t.is(error.message, 'invalid length'); }); +test ('random_hex should always return correct length', (t)=>{ + for (let i = 1; i < 32; i++) { + const hex = crypto.random_hex (i); + t.is (hex.length, i); + } +}); + test ('random_string', (t) => { const str = crypto.random_string (16); t.is (str.length, 16); @@ -46,6 +53,14 @@ test ('random_string should refuse lenght smaller 1', (t) => { t.is(error.message, 'invalid length'); }); +test ('random_string should always return correct length', (t)=>{ + for (let i = 1; i < 32; i++) { + const str = crypto.random_string (i); + t.is (str.length, i); + } +}); + + test ('hash_sha512', (t) => { const hash = crypto.hash_sha512 ('a', 'b'); t.is (