This commit is contained in:
Timo Hocker
2020-03-04 15:35:04 +01:00
parent 850515cc42
commit 85e3303341
3 changed files with 4560 additions and 28 deletions

View File

@ -1,3 +1,5 @@
/* eslint-disable no-magic-numbers */
// @ts-nocheck
'use strict';
const test = require ('ava');
@ -19,3 +21,18 @@ test ('fail decryption', (t) => {
const dec = crypto.decrypt_aes (enc, 'baz');
t.is (dec, null);
});
test ('unique crypto strings', (t) => {
const enc = [
crypto.encrypt_aes ('foo', 'bar'),
crypto.encrypt_aes ('foo', 'bar'),
crypto.encrypt_aes ('foo', 'bar'),
crypto.encrypt_aes ('foo', 'bar'),
crypto.encrypt_aes ('foo', 'bar'),
crypto.encrypt_aes ('foo', 'bar'),
crypto.encrypt_aes ('foo', 'bar'),
crypto.encrypt_aes ('foo', 'bar')
];
const unique = enc.filter ((v, i) => enc.indexOf (v) === i).length;
t.is (unique, 8);
});