Check valid email address earlier in pgp.parseUserIds

This commit is contained in:
Tankred Hase
2016-06-10 18:43:09 +02:00
parent f1bf3caa20
commit 12b65e0ce2
2 changed files with 8 additions and 7 deletions

View File

@@ -182,8 +182,9 @@ describe('PGP Unit Tests', () => {
it('should throw for a invalid email address', () => {
let verifyStub = sinon.stub(key.users[0], 'isValidSelfCertificate').returns(true);
key.users[0].userId.userid = 'safewithme.testusergmail.com';
expect(pgp.parseUserIds.bind(pgp, key.users, key.primaryKey)).to.throw(/invalid email address/);
key.users[0].userId.userid = 'safewithme testuser <safewithme.testusergmail.com>';
let parsed = pgp.parseUserIds(key.users, key.primaryKey);
expect(parsed.length).to.equal(0);
verifyStub.restore();
});
});