Write unit tests for util.js

This commit is contained in:
Tankred Hase
2016-05-31 13:48:59 +02:00
parent 23ee139857
commit c8db7388c3
2 changed files with 151 additions and 3 deletions

View File

@@ -56,7 +56,7 @@ exports.validateAddress = function(data) {
/**
* Validate an ascii armored public PGP key block.
* @param {string} data The armored key block
* @return {boolean} If the key is valid
* @return {boolean} If the key is valid
*/
exports.validatePublicKey = function(data) {
if (!this.isString(data)) {
@@ -88,11 +88,11 @@ exports.parseUserIds = function(userIds) {
*/
exports.deDup = function(list) {
var result = [];
(list || []).forEach(function(i) {
for (let i of list) {
if (result.indexOf(i) === -1) {
result.push(i);
}
});
}
return result;
};