Skip to content

Commit 3450bd6

Browse files
committed
Fixed e2e tests
1 parent a40d725 commit 3450bd6

File tree

4 files changed

+35
-37
lines changed

4 files changed

+35
-37
lines changed

e2e/infrastructure/AccountHttp.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ describe('AccountHttp', () => {
182182
transactionHttp.announce(signedTransaction);
183183
});
184184
});
185+
185186
describe('Setup Test AccountAddressProperty', () => {
186187
let listener: Listener;
187188
before (() => {

e2e/infrastructure/MosaicHttp.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ describe('MosaicHttp', () => {
7070
it('Announce MosaicDefinitionTransaction', (done) => {
7171
const nonce = MosaicNonce.createRandom();
7272
mosaicId = MosaicId.createFromNonce(nonce, account.publicAccount);
73+
console.log(mosaicId.toHex());
7374
const mosaicDefinitionTransaction = MosaicDefinitionTransaction.create(
7475
Deadline.create(),
7576
nonce,

e2e/infrastructure/TransactionHttp.spec.ts

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,7 @@ describe('TransactionHttp', () => {
774774
NetworkType.MIJIN_TEST,
775775
[],
776776
);
777-
const signedTransaction = account.sign(aggregateTransaction);
777+
const signedTransaction = account.sign(aggregateTransaction, generationHash);
778778
const hashLockTransaction = HashLockTransaction.create(Deadline.create(),
779779
new Mosaic(new NamespaceId('cat.currency'), UInt64.fromUint(10 * Math.pow(10, NetworkCurrencyMosaic.DIVISIBILITY))),
780780
UInt64.fromUint(10000),
@@ -789,7 +789,7 @@ describe('TransactionHttp', () => {
789789
assert(false);
790790
done();
791791
});
792-
transactionHttp.announce(hashLockTransaction.signWith(account));
792+
transactionHttp.announce(hashLockTransaction.signWith(account, generationHash));
793793
});
794794
});
795795

@@ -910,8 +910,6 @@ describe('TransactionHttp', () => {
910910
return listener.close();
911911
});
912912
it('should announce aggregated complete transaction', (done) => {
913-
const signerAccount = account;
914-
915913
const tx = TransferTransaction.create(
916914
Deadline.create(),
917915
account2.address,
@@ -922,12 +920,12 @@ describe('TransactionHttp', () => {
922920
const aggTx = AggregateTransaction.createComplete(
923921
Deadline.create(),
924922
[
925-
tx.toAggregate(signerAccount.publicAccount),
923+
tx.toAggregate(account.publicAccount),
926924
],
927925
NetworkType.MIJIN_TEST,
928926
[],
929927
);
930-
const signedTx = signerAccount.sign(aggTx, generationHash);
928+
const signedTx = account.sign(aggTx, generationHash);
931929
listener.confirmed(account.address).subscribe((transaction: Transaction) => {
932930
done();
933931
});
@@ -1225,6 +1223,9 @@ describe('TransactionHttp', () => {
12251223
NetworkType.MIJIN_TEST,
12261224
);
12271225
listener.confirmed(account.address).subscribe((transaction: Transaction) => {
1226+
listener.confirmed(account2.address).subscribe((transaction: Transaction) => {
1227+
done();
1228+
});
12281229
const secretProofTransaction = SecretProofTransaction.create(
12291230
Deadline.create(),
12301231
HashType.Op_Sha3_256,
@@ -1236,9 +1237,6 @@ describe('TransactionHttp', () => {
12361237
const signedTx = secretProofTransaction.signWith(account2, generationHash);
12371238
transactionHttp.announce(signedTx);
12381239
});
1239-
listener.confirmed(account2.address).subscribe((transaction: Transaction) => {
1240-
done();
1241-
});
12421240
listener.status(account2.address).subscribe((error) => {
12431241
console.log('Error:', error);
12441242
assert(false);
@@ -1286,7 +1284,7 @@ describe('TransactionHttp', () => {
12861284
[secretProofTransaction.toAggregate(account2.publicAccount)],
12871285
NetworkType.MIJIN_TEST,
12881286
[]);
1289-
transactionHttp.announce(aggregateSecretProofTransaction.signWith(account2,generationHash));
1287+
transactionHttp.announce(aggregateSecretProofTransaction.signWith(account2, generationHash));
12901288
});
12911289
listener.status(account.address).subscribe((error) => {
12921290
console.log('Error:', error);
@@ -1378,7 +1376,7 @@ describe('TransactionHttp', () => {
13781376
[secretProofTransaction.toAggregate(account2.publicAccount)],
13791377
NetworkType.MIJIN_TEST,
13801378
[]);
1381-
transactionHttp.announce(aggregateSecretProofTransaction.signWith(account2,generationHash));
1379+
transactionHttp.announce(aggregateSecretProofTransaction.signWith(account2, generationHash));
13821380
});
13831381
listener.status(account.address).subscribe((error) => {
13841382
console.log('Error:', error);
@@ -1413,6 +1411,14 @@ describe('TransactionHttp', () => {
14131411
NetworkType.MIJIN_TEST,
14141412
);
14151413
listener.confirmed(account.address).subscribe((transaction: Transaction) => {
1414+
listener.confirmed(account2.address).subscribe((transaction: Transaction) => {
1415+
done();
1416+
});
1417+
listener.status(account2.address).subscribe((error) => {
1418+
console.log('Error:', error);
1419+
assert(false);
1420+
done();
1421+
});
14161422
const secretProofTransaction = SecretProofTransaction.create(
14171423
Deadline.create(),
14181424
HashType.Op_Hash_160,
@@ -1424,14 +1430,6 @@ describe('TransactionHttp', () => {
14241430
const signedTx = secretProofTransaction.signWith(account2, generationHash);
14251431
transactionHttp.announce(signedTx);
14261432
});
1427-
listener.confirmed(account2.address).subscribe((transaction: Transaction) => {
1428-
done();
1429-
});
1430-
listener.status(account2.address).subscribe((error) => {
1431-
console.log('Error:', error);
1432-
assert(false);
1433-
done();
1434-
});
14351433
listener.status(account.address).subscribe((error) => {
14361434
console.log('Error:', error);
14371435
assert(false);
@@ -1485,7 +1483,7 @@ describe('TransactionHttp', () => {
14851483
[secretProofTransaction.toAggregate(account2.publicAccount)],
14861484
NetworkType.MIJIN_TEST,
14871485
[]);
1488-
transactionHttp.announce(aggregateSecretProofTransaction.signWith(account2,generationHash));
1486+
transactionHttp.announce(aggregateSecretProofTransaction.signWith(account2, generationHash));
14891487
});
14901488
listener.status(account.address).subscribe((error) => {
14911489
console.log('Error:', error);
@@ -1591,7 +1589,7 @@ describe('TransactionHttp', () => {
15911589
[secretProofTransaction.toAggregate(account2.publicAccount)],
15921590
NetworkType.MIJIN_TEST,
15931591
[]);
1594-
transactionHttp.announce(aggregateSecretProofTransaction.signWith(account2,generationHash));
1592+
transactionHttp.announce(aggregateSecretProofTransaction.signWith(account2, generationHash));
15951593
});
15961594
listener.status(account.address).subscribe((error) => {
15971595
console.log('Error:', error);

src/infrastructure/MosaicHttp.ts

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -60,19 +60,18 @@ export class MosaicHttp extends Http implements MosaicRepository {
6060
return this.getNetworkTypeObservable().pipe(
6161
mergeMap((networkType) => observableFrom(
6262
this.mosaicRoutesApi.getMosaic(mosaicId.toHex())).pipe(map((mosaicInfoDTO) => {
63-
return new MosaicInfo(
64-
mosaicInfoDTO.meta.id,
65-
new MosaicId(mosaicInfoDTO.mosaic.mosaicId),
66-
new UInt64(mosaicInfoDTO.mosaic.supply),
67-
new UInt64(mosaicInfoDTO.mosaic.height),
68-
PublicAccount.createFromPublicKey(mosaicInfoDTO.mosaic.owner, networkType),
69-
mosaicInfoDTO.mosaic.revision,
70-
new MosaicProperties(
71-
new UInt64(mosaicInfoDTO.mosaic.properties[0]),
72-
(new UInt64(mosaicInfoDTO.mosaic.properties[1])).compact(),
73-
new UInt64(mosaicInfoDTO.mosaic.properties[2]),
74-
),
75-
);
63+
return new MosaicInfo(
64+
mosaicInfoDTO.meta.id,
65+
new MosaicId(mosaicInfoDTO.mosaic.mosaicId),
66+
new UInt64(mosaicInfoDTO.mosaic.supply),
67+
new UInt64(mosaicInfoDTO.mosaic.height),
68+
PublicAccount.createFromPublicKey(mosaicInfoDTO.mosaic.owner, networkType),
69+
mosaicInfoDTO.mosaic.revision,
70+
new MosaicProperties(
71+
new UInt64(mosaicInfoDTO.mosaic.properties[0].value),
72+
(new UInt64(mosaicInfoDTO.mosaic.properties[1].value)).compact(),
73+
),
74+
);
7675
}))));
7776
}
7877

@@ -97,9 +96,8 @@ export class MosaicHttp extends Http implements MosaicRepository {
9796
PublicAccount.createFromPublicKey(mosaicInfoDTO.mosaic.owner, networkType),
9897
mosaicInfoDTO.mosaic.revision,
9998
new MosaicProperties(
100-
new UInt64(mosaicInfoDTO.mosaic.properties[0]),
101-
(new UInt64(mosaicInfoDTO.mosaic.properties[1])).compact(),
102-
new UInt64(mosaicInfoDTO.mosaic.properties[2]),
99+
new UInt64(mosaicInfoDTO.mosaic.properties[0].value),
100+
(new UInt64(mosaicInfoDTO.mosaic.properties[1].value)).compact(),
103101
),
104102
);
105103
});

0 commit comments

Comments
 (0)