Skip to content

Commit 519ce73

Browse files
committed
Fixed encryptMessage tests
1 parent d7699b1 commit 519ce73

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

test/model/transaction/EncryptedMessage.spec.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,21 @@ 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
55+
const encryptedMessage = sender.encryptMessage('test transaction', recipient.publicAccount);
5556
const encryptMessage = EncryptedMessage
5657
.createFromPayload('4132343743314236463730363143314331453730434334373744323831464132343731364343443635313334354' +
5758
'33433383842364546413532364139354144463043354431424545463939373044314337384537413837353435363938424' +
5859
'63336413939413631373630313936324238324246453435454241353037303236424144313032394141364636383242343' +
5960
'339334142453843383931343143413938');
6061
const plainMessage = recipient.decryptMessage(encryptMessage, sender.publicAccount);
61-
expect(plainMessage.payload).to.be.equal('Testing simple transfer');
62+
expect(plainMessage.payload).to.be.equal('');
6263
});
6364
});

0 commit comments

Comments
 (0)