Skip to content
This repository has been archived by the owner on Apr 4, 2022. It is now read-only.

Commit

Permalink
add test (#176)
Browse files Browse the repository at this point in the history
update mailchain service
  • Loading branch information
tboeckmann committed Mar 28, 2020
1 parent 73dd51c commit a504f48
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/app/services/mailchain/mailchain.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@ describe('MailchainService', () => {

expect(response).toEqual(ethereumAccountAddress)
});

it('should return a blank string if the Mailchain address is invalid', () => {
const mailchainAddress = "<0x@ropsten.ethereum>"

let response = mailchainService.parseAddressFromMailchain(mailchainAddress)

expect(response).toEqual('')
});
})

describe('dedupeMessagesByIds', () => {
Expand Down
2 changes: 2 additions & 0 deletions src/app/services/mailchain/mailchain.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ export class MailchainService {
var regexMailAddr = new RegExp('<0x[0-9a-fA-Z]{40}[@].+>$');
if (regexMailAddr.test(address)) {
return address.substr(1, address.indexOf('@') - 1);
} else {
return ''
}
}

Expand Down

0 comments on commit a504f48

Please sign in to comment.