Skip to content

Commit 552afbc

Browse files
author
Grégory Saive
authored
Merge pull request #156 from rg911/master
Fixed EncryptedMessage unit test issues
2 parents 12eb5a2 + 146228b commit 552afbc

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

test/model/transaction/EncryptedMessage.spec.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,19 @@ describe('EncryptedMessage', () => {
4444
});
4545

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

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

0 commit comments

Comments
 (0)