@@ -20,39 +20,32 @@ import {Account} from '../../../src/model/account/Account';
2020import { PublicAccount } from '../../../src/model/account/PublicAccount' ;
2121import { NetworkType } from '../../../src/model/blockchain/NetworkType' ;
2222import { EncryptedMessage } from '../../../src/model/transaction/EncryptedMessage' ;
23-
23+ import { TestingAccount } from '../../conf/conf.spec' ;
2424
2525describe ( 'EncryptedMessage' , ( ) => {
2626
27- const accountInformation = {
28- address : 'SCTVW23D2MN5VE4AQ4TZIDZENGNOZXPRPRLIKCF2' ,
29- privateKey : '26b64cb10f005e5988a36744ca19e20d835ccc7c105aaa5f3b212da593180930' . toUpperCase ( ) ,
30- publicKey : 'c2f93346e27ce6ad1a9f8f5e3066f8326593a406bdf357acb041e2f9ab402efe' . toUpperCase ( ) ,
31- } ;
32- let recipientPublicAccount :PublicAccount ;
27+ let account : Account ;
3328
3429 before ( ( ) => {
35- recipientPublicAccount = PublicAccount . createFromPublicKey ( accountInformation . publicKey , NetworkType . MIJIN_TEST ) ;
30+ account = TestingAccount ;
3631 } ) ;
3732
38- it ( " should create a encrypted message from a DTO" , ( ) => {
39- const encryptedMessage = EncryptedMessage . createFromDTO ( " test transaction" ) ;
40- expect ( encryptedMessage . payload ) . to . be . equal ( " test transaction" ) ;
33+ it ( ' should create a encrypted message from a DTO' , ( ) => {
34+ const encryptedMessage = EncryptedMessage . createFromDTO ( ' test transaction' ) ;
35+ expect ( encryptedMessage . payload ) . to . be . equal ( ' test transaction' ) ;
4136 } ) ;
4237
43- it ( "should return encrypted message dto" , ( ) => {
44- const account = Account . createFromPrivateKey ( accountInformation . privateKey , NetworkType . MIJIN_TEST ) ;
45- const publicAccount = PublicAccount . createFromPublicKey ( account . publicKey , NetworkType . MIJIN_TEST ) ;
46- const encryptedMessage = account . encryptMessage ( "test transaction" , publicAccount ) ;
47- const plainMessage = account . decryptMessage ( encryptedMessage , publicAccount ) ;
48- expect ( plainMessage . payload ) . to . be . equal ( "test transaction" ) ;
38+ it ( 'should return encrypted message dto' , ( ) => { ;
39+ const encryptedMessage = account . encryptMessage ( 'test transaction' , account . publicAccount ) ;
40+ const plainMessage = account . decryptMessage ( encryptedMessage , account . publicAccount ) ;
41+ expect ( plainMessage . payload ) . to . be . equal ( 'test transaction' ) ;
4942 } ) ;
5043
51- it ( " should create an encrypted message from a DTO and decrypt it" , ( ) => {
52- const account = Account . createFromPrivateKey ( accountInformation . privateKey , NetworkType . MIJIN_TEST ) ;
53- const publicAccount = PublicAccount . createFromPublicKey ( "0414fe7647ec008e533aac98a4bf1c5fbf1d236c75b81fdadf1f5d1042fdd2ff" , NetworkType . MIJIN_TEST ) ;
54- const encryptMessage = EncryptedMessage . createFromDTO ( "02bb332c0fdd445455117882b2bec5e49f5713860d6b34650d0f769159d021a27518ea03539af8913231b9f80f600daae9291bb100a6d32e36b52a6c457fea287ca9942a32368618fe1fd0c185dbf834" ) ;
55- const plainMessage = account . decryptMessage ( encryptMessage , publicAccount ) ;
56- expect ( plainMessage . payload ) . to . be . equal ( " test transaction" ) ;
44+ it ( ' should create an encrypted message from a DTO and decrypt it' , ( ) => {
45+ const encryptMessage = EncryptedMessage
46+ . createFromDTO ( '1E4DCC2C381A0346F72346F758B5D6C1CF236B96E2E68B9B40FB7EEF7FB035F6401A1993E6F5F0B1379' +
47+ '7A6593358F06C90dee57f68880931f7062ecf9ec0c0837bb583732474442db72d71255250b021' ) ;
48+ const plainMessage = account . decryptMessage ( encryptMessage , account . publicAccount ) ;
49+ expect ( plainMessage . payload ) . to . be . equal ( ' test transaction' ) ;
5750 } ) ;
5851} ) ;
0 commit comments