test for invalid length on random hex

This commit is contained in:
Timo Hocker 2020-03-09 07:58:26 +01:00
parent 6fd21e4e36
commit 91f7d66dbb

View File

@ -23,7 +23,10 @@ test ('random_hex with default length', (t) => {
}); });
test ('random_hex should refuse lenght smaller 1', (t) => { test ('random_hex should refuse lenght smaller 1', (t) => {
t.throws (() => (crypto.random_hex (0))); const error = t.throws (
() => (crypto.random_hex (0))
);
t.is(error.message, 'invalid length');
}); });
test ('random_string', (t) => { test ('random_string', (t) => {