Skip to content

Commit c266205

Browse files
committed
Added e2e test for SecretLockTx with mosaicAlias
1 parent 86df069 commit c266205

File tree

2 files changed

+65
-32
lines changed

2 files changed

+65
-32
lines changed

e2e/infrastructure/MosaicHttp.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,21 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
import {expect, assert} from 'chai';
16+
import {assert, expect} from 'chai';
1717
import { Listener, TransactionHttp } from '../../src/infrastructure/infrastructure';
1818
import {MosaicHttp} from '../../src/infrastructure/MosaicHttp';
1919
import { Account } from '../../src/model/account/Account';
2020
import { NetworkType } from '../../src/model/blockchain/NetworkType';
2121
import {MosaicId} from '../../src/model/mosaic/MosaicId';
2222
import { MosaicNonce } from '../../src/model/mosaic/MosaicNonce';
2323
import { MosaicProperties } from '../../src/model/mosaic/MosaicProperties';
24+
import { AliasActionType } from '../../src/model/namespace/AliasActionType';
2425
import {NamespaceId} from '../../src/model/namespace/NamespaceId';
2526
import { Deadline } from '../../src/model/transaction/Deadline';
27+
import { MosaicAliasTransaction } from '../../src/model/transaction/MosaicAliasTransaction';
2628
import { MosaicDefinitionTransaction } from '../../src/model/transaction/MosaicDefinitionTransaction';
2729
import { RegisterNamespaceTransaction } from '../../src/model/transaction/RegisterNamespaceTransaction';
2830
import { UInt64 } from '../../src/model/UInt64';
29-
import { MosaicAliasTransaction } from '../../src/model/transaction/MosaicAliasTransaction';
30-
import { AliasActionType } from '../../src/model/namespace/AliasActionType';
3131

3232
describe('MosaicHttp', () => {
3333
let mosaicId: MosaicId;

e2e/infrastructure/TransactionHttp.spec.ts

Lines changed: 62 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,8 @@ describe('TransactionHttp', () => {
661661
transactionHttp.announce(signedTransaction);
662662
});
663663
});
664-
describe('MosaicAliasTransaction', () => {
664+
665+
describe('MosaicSupplyChangeTransaction', () => {
665666
let listener: Listener;
666667
before (() => {
667668
listener = new Listener(config.apiUrl);
@@ -670,29 +671,27 @@ describe('TransactionHttp', () => {
670671
after(() => {
671672
return listener.close();
672673
});
673-
674674
it('standalone', (done) => {
675-
const mosaicAliasTransaction = MosaicAliasTransaction.create(
675+
const mosaicSupplyChangeTransaction = MosaicSupplyChangeTransaction.create(
676676
Deadline.create(),
677-
AliasActionType.Link,
678-
namespaceId,
679677
mosaicId,
678+
MosaicSupplyType.Increase,
679+
UInt64.fromUint(10),
680680
NetworkType.MIJIN_TEST,
681681
);
682-
const signedTransaction = mosaicAliasTransaction.signWith(account);
683-
682+
const signedTransaction = mosaicSupplyChangeTransaction.signWith(account);
684683
listener.confirmed(account.address).subscribe((transaction: Transaction) => {
685684
done();
686685
});
687-
listener.status(account.address).subscribe((error) => {
686+
listener.status(account3.address).subscribe((error) => {
688687
console.log('Error:', error);
689688
assert(false);
690689
done();
691690
});
692691
transactionHttp.announce(signedTransaction);
693692
});
694693
});
695-
describe('MosaicAliasTransaction', () => {
694+
describe('MosaicSupplyChangeTransaction', () => {
696695
let listener: Listener;
697696
before (() => {
698697
listener = new Listener(config.apiUrl);
@@ -702,23 +701,22 @@ describe('TransactionHttp', () => {
702701
return listener.close();
703702
});
704703
it('aggregate', (done) => {
705-
const mosaicAliasTransaction = MosaicAliasTransaction.create(
704+
const mosaicSupplyChangeTransaction = MosaicSupplyChangeTransaction.create(
706705
Deadline.create(),
707-
AliasActionType.Unlink,
708-
namespaceId,
709706
mosaicId,
707+
MosaicSupplyType.Increase,
708+
UInt64.fromUint(10),
710709
NetworkType.MIJIN_TEST,
711710
);
712711
const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(),
713-
[mosaicAliasTransaction.toAggregate(account.publicAccount)],
712+
[mosaicSupplyChangeTransaction.toAggregate(account.publicAccount)],
714713
NetworkType.MIJIN_TEST,
715-
[],
716-
);
714+
[]);
717715
const signedTransaction = aggregateTransaction.signWith(account);
718716
listener.confirmed(account.address).subscribe((transaction: Transaction) => {
719717
done();
720718
});
721-
listener.status(account.address).subscribe((error) => {
719+
listener.status(account3.address).subscribe((error) => {
722720
console.log('Error:', error);
723721
assert(false);
724722
done();
@@ -727,7 +725,7 @@ describe('TransactionHttp', () => {
727725
});
728726
});
729727

730-
describe('MosaicSupplyChangeTransaction', () => {
728+
describe('MosaicAliasTransaction', () => {
731729
let listener: Listener;
732730
before (() => {
733731
listener = new Listener(config.apiUrl);
@@ -736,27 +734,61 @@ describe('TransactionHttp', () => {
736734
after(() => {
737735
return listener.close();
738736
});
737+
739738
it('standalone', (done) => {
740-
const mosaicSupplyChangeTransaction = MosaicSupplyChangeTransaction.create(
739+
const mosaicAliasTransaction = MosaicAliasTransaction.create(
741740
Deadline.create(),
741+
AliasActionType.Link,
742+
namespaceId,
742743
mosaicId,
743-
MosaicSupplyType.Increase,
744-
UInt64.fromUint(10),
745744
NetworkType.MIJIN_TEST,
746745
);
747-
const signedTransaction = mosaicSupplyChangeTransaction.signWith(account);
746+
const signedTransaction = mosaicAliasTransaction.signWith(account);
747+
748748
listener.confirmed(account.address).subscribe((transaction: Transaction) => {
749749
done();
750750
});
751-
listener.status(account3.address).subscribe((error) => {
751+
listener.status(account.address).subscribe((error) => {
752752
console.log('Error:', error);
753753
assert(false);
754754
done();
755755
});
756756
transactionHttp.announce(signedTransaction);
757757
});
758758
});
759-
describe('MosaicSupplyChangeTransaction', () => {
759+
760+
describe('SecretLockTransaction - MosaicAlias', () => {
761+
let listener: Listener;
762+
before (() => {
763+
listener = new Listener(config.apiUrl);
764+
return listener.open();
765+
});
766+
after(() => {
767+
return listener.close();
768+
});
769+
it('standalone', (done) => {
770+
const secretLockTransaction = SecretLockTransaction.create(
771+
Deadline.create(),
772+
new Mosaic(namespaceId, UInt64.fromUint(10 * Math.pow(10, NetworkCurrencyMosaic.DIVISIBILITY))),
773+
UInt64.fromUint(100),
774+
HashType.Op_Sha3_256,
775+
sha3_256.create().update(nacl_catapult.randomBytes(20)).hex(),
776+
account2.address,
777+
NetworkType.MIJIN_TEST,
778+
);
779+
listener.confirmed(account.address).subscribe((transaction: Transaction) => {
780+
done();
781+
});
782+
listener.status(account.address).subscribe((error) => {
783+
console.log('Error:', error);
784+
assert(false);
785+
done();
786+
});
787+
transactionHttp.announce(secretLockTransaction.signWith(account));
788+
});
789+
});
790+
791+
describe('MosaicAliasTransaction', () => {
760792
let listener: Listener;
761793
before (() => {
762794
listener = new Listener(config.apiUrl);
@@ -766,22 +798,23 @@ describe('TransactionHttp', () => {
766798
return listener.close();
767799
});
768800
it('aggregate', (done) => {
769-
const mosaicSupplyChangeTransaction = MosaicSupplyChangeTransaction.create(
801+
const mosaicAliasTransaction = MosaicAliasTransaction.create(
770802
Deadline.create(),
803+
AliasActionType.Unlink,
804+
namespaceId,
771805
mosaicId,
772-
MosaicSupplyType.Increase,
773-
UInt64.fromUint(10),
774806
NetworkType.MIJIN_TEST,
775807
);
776808
const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(),
777-
[mosaicSupplyChangeTransaction.toAggregate(account.publicAccount)],
809+
[mosaicAliasTransaction.toAggregate(account.publicAccount)],
778810
NetworkType.MIJIN_TEST,
779-
[]);
811+
[],
812+
);
780813
const signedTransaction = aggregateTransaction.signWith(account);
781814
listener.confirmed(account.address).subscribe((transaction: Transaction) => {
782815
done();
783816
});
784-
listener.status(account3.address).subscribe((error) => {
817+
listener.status(account.address).subscribe((error) => {
785818
console.log('Error:', error);
786819
assert(false);
787820
done();

0 commit comments

Comments
 (0)