Skip to content

Commit

Permalink
Merge pull request #156 from rg911/master
Browse files Browse the repository at this point in the history
Fixed EncryptedMessage unit test issues
  • Loading branch information
Grégory Saive authored Jun 3, 2019
2 parents 12eb5a2 + 146228b commit 552afbc
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions test/model/transaction/EncryptedMessage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,19 @@ describe('EncryptedMessage', () => {
});

it('should decrypt message from raw encrypted message payload', () => {
const payload = 'AE044953E4FF05BC3C14AA10B367E8563D8929680C0D75DBC180F9A7B927D335E66C3BA94266408B366F88B1E503EB' +
'4A3730D9B2F16F1FC16E335262A701CC786E6739A38880A6788530A9E8E4D13C7F';
const encryptedMessage = sender.encryptMessage('Testing simple transfer', recipient.publicAccount);
const payload = encryptedMessage.payload;
const plainMessage = recipient.decryptMessage(new EncryptedMessage(payload), sender.publicAccount);
expect(plainMessage.payload).to.be.equal('Testing simple transfer');
});

it('should create an encrypted message from a DTO and decrypt it', () => {
it('should return empty string if given payload is not valid', () => {
// message payload generated from catapult-server
const encryptMessage = EncryptedMessage
.createFromPayload('4132343743314236463730363143314331453730434334373744323831464132343731364343443635313334354' +
'33433383842364546413532364139354144463043354431424545463939373044314337384537413837353435363938424' +
'63336413939413631373630313936324238324246453435454241353037303236424144313032394141364636383242343' +
'339334142453843383931343143413938');
.createFromPayload('3131313842393038373141353141363431453630414537413636314638454645463' +
'946383431364646344336304536324443304235303943394242433039364230383343363438374' +
'137364239433434314433303932363942414536434339364230423339454430303233453236333' +
'8373531414345313132443732353430344341374632353634324642383230433744373633413434313132323833414639');
const plainMessage = recipient.decryptMessage(encryptMessage, sender.publicAccount);
expect(plainMessage.payload).to.be.equal('Testing simple transfer');
});
Expand Down

0 comments on commit 552afbc

Please sign in to comment.