Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions e2e/infrastructure/AccountHttp.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import { toArray, take } from 'rxjs/operators';
import { deepEqual } from 'assert';
import { Order } from '../../src/infrastructure/infrastructure';
import { AccountOrderBy } from '../../src/infrastructure/searchCriteria/AccountOrderBy';
import { Duration } from 'js-joda';

describe('AccountHttp', () => {
const helper = new IntegrationTestHelper();
Expand All @@ -56,6 +57,8 @@ describe('AccountHttp', () => {
let generationHash: string;
let networkType: NetworkType;

const epochAdjustment = Duration.ofSeconds(1573430400);

before(() => {
return helper.start({ openListener: true }).then(() => {
account = helper.account;
Expand Down Expand Up @@ -87,7 +90,7 @@ describe('AccountHttp', () => {
describe('Make sure test account is not virgin', () => {
it('Announce TransferTransaction', () => {
const transferTransaction = TransferTransaction.create(
Deadline.create(),
Deadline.create(epochAdjustment),
account2.address,
[helper.createNetworkCurrency(1, false)],
PlainMessage.create('test-message'),
Expand All @@ -104,7 +107,7 @@ describe('AccountHttp', () => {
it('Announce NamespaceRegistrationTransaction', () => {
const namespaceName = 'root-test-namespace-' + Math.floor(Math.random() * 10000);
const registerNamespaceTransaction = NamespaceRegistrationTransaction.createRootNamespace(
Deadline.create(),
Deadline.create(epochAdjustment),
namespaceName,
UInt64.fromUint(9),
networkType,
Expand All @@ -119,7 +122,7 @@ describe('AccountHttp', () => {
describe('Setup test AddressAlias', () => {
it('Announce addressAliasTransaction', () => {
const addressAliasTransaction = AddressAliasTransaction.create(
Deadline.create(),
Deadline.create(epochAdjustment),
AliasAction.Link,
namespaceId,
account.address,
Expand All @@ -134,7 +137,7 @@ describe('AccountHttp', () => {
describe('Setup test multisig account', () => {
it('Announce MultisigAccountModificationTransaction', () => {
const modifyMultisigAccountTransaction = MultisigAccountModificationTransaction.create(
Deadline.create(),
Deadline.create(epochAdjustment),
2,
1,
[cosignAccount1.address, cosignAccount2.address, cosignAccount3.address],
Expand All @@ -144,7 +147,7 @@ describe('AccountHttp', () => {
);

const aggregateTransaction = AggregateTransaction.createComplete(
Deadline.create(),
Deadline.create(epochAdjustment),
[modifyMultisigAccountTransaction.toAggregate(multisigAccount.publicAccount)],
networkType,
[],
Expand Down Expand Up @@ -249,7 +252,7 @@ describe('AccountHttp', () => {
describe('Remove test AddressAlias', () => {
it('Announce addressAliasTransaction', () => {
const addressAliasTransaction = AddressAliasTransaction.create(
Deadline.create(),
Deadline.create(epochAdjustment),
AliasAction.Unlink,
namespaceId,
account.address,
Expand All @@ -264,7 +267,7 @@ describe('AccountHttp', () => {
describe('Restore test multisig Accounts', () => {
it('Announce MultisigAccountModificationTransaction', () => {
const removeCosigner1 = MultisigAccountModificationTransaction.create(
Deadline.create(),
Deadline.create(epochAdjustment),
-1,
0,
[],
Expand All @@ -273,7 +276,7 @@ describe('AccountHttp', () => {
helper.maxFee,
);
const removeCosigner2 = MultisigAccountModificationTransaction.create(
Deadline.create(),
Deadline.create(epochAdjustment),
0,
0,
[],
Expand All @@ -283,7 +286,7 @@ describe('AccountHttp', () => {
);

const removeCosigner3 = MultisigAccountModificationTransaction.create(
Deadline.create(),
Deadline.create(epochAdjustment),
-1,
-1,
[],
Expand All @@ -293,7 +296,7 @@ describe('AccountHttp', () => {
);

const aggregateTransaction = AggregateTransaction.createComplete(
Deadline.create(),
Deadline.create(epochAdjustment),
[
removeCosigner1.toAggregate(multisigAccount.publicAccount),
removeCosigner2.toAggregate(multisigAccount.publicAccount),
Expand Down
5 changes: 4 additions & 1 deletion e2e/infrastructure/BlockHttp.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import { take } from 'rxjs/operators';
import { TransactionStatement } from '../../src/model/model';
import { ReceiptPaginationStreamer } from '../../src/infrastructure/paginationStreamer/ReceiptPaginationStreamer';
import { Order } from '../../src/infrastructure/infrastructure';
import { Duration } from 'js-joda';

describe('BlockHttp', () => {
const helper = new IntegrationTestHelper();
Expand All @@ -43,6 +44,8 @@ describe('BlockHttp', () => {
let networkType: NetworkType;
let transactionHash;

const epochAdjustment = Duration.ofSeconds(1573430400);

before(() => {
return helper.start({ openListener: true }).then(() => {
account = helper.account;
Expand All @@ -67,7 +70,7 @@ describe('BlockHttp', () => {
describe('Setup Test Data', () => {
it('Announce TransferTransaction FER', () => {
const transferTransaction = TransferTransaction.create(
Deadline.create(),
Deadline.create(epochAdjustment),
account2.address,
[helper.createNetworkCurrency(1, false)],
PlainMessage.create('test-message'),
Expand Down
21 changes: 12 additions & 9 deletions e2e/infrastructure/HashLockHttp.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import { ChronoUnit } from 'js-joda';
import { SignedTransaction } from '../../src/model/transaction/SignedTransaction';
import { UnresolvedMosaicId } from '../../src/model/mosaic/UnresolvedMosaicId';
import { HashLockRepository } from '../../src/infrastructure/HashLockRepository';
import { Duration } from 'js-joda';

describe('HashLockHttp', () => {
const helper = new IntegrationTestHelper();
Expand All @@ -48,6 +49,8 @@ describe('HashLockHttp', () => {
let generationHash: string;
let networkType: NetworkType;

const epochAdjustment = Duration.ofSeconds(1573430400);

before(() => {
return helper.start({ openListener: true }).then(() => {
account = helper.account;
Expand All @@ -68,7 +71,7 @@ describe('HashLockHttp', () => {

const createSignedAggregatedBondTransaction = (aggregatedTo: Account, signer: Account, recipient: Address): SignedTransaction => {
const transferTransaction = TransferTransaction.create(
Deadline.create(),
Deadline.create(epochAdjustment),
recipient,
[],
PlainMessage.create('test-message'),
Expand All @@ -77,7 +80,7 @@ describe('HashLockHttp', () => {
);

const aggregateTransaction = AggregateTransaction.createBonded(
Deadline.create(2, ChronoUnit.MINUTES),
Deadline.create(epochAdjustment, 2, ChronoUnit.MINUTES),
[transferTransaction.toAggregate(aggregatedTo.publicAccount)],
networkType,
[],
Expand All @@ -92,7 +95,7 @@ describe('HashLockHttp', () => {
mosaicId: UnresolvedMosaicId,
): any => {
const lockFundsTransaction = LockFundsTransaction.create(
Deadline.create(),
Deadline.create(epochAdjustment),
new Mosaic(mosaicId, UInt64.fromUint(10 * Math.pow(10, helper.networkCurrencyDivisibility))),
UInt64.fromUint(1000),
signedAggregatedTransaction,
Expand All @@ -112,7 +115,7 @@ describe('HashLockHttp', () => {
describe('Setup test multisig account', () => {
it('Announce MultisigAccountModificationTransaction', () => {
const modifyMultisigAccountTransaction = MultisigAccountModificationTransaction.create(
Deadline.create(),
Deadline.create(epochAdjustment),
2,
1,
[cosignAccount1.address, cosignAccount2.address, cosignAccount3.address],
Expand All @@ -122,7 +125,7 @@ describe('HashLockHttp', () => {
);

const aggregateTransaction = AggregateTransaction.createComplete(
Deadline.create(),
Deadline.create(epochAdjustment),
[modifyMultisigAccountTransaction.toAggregate(multisigAccount.publicAccount)],
networkType,
[],
Expand Down Expand Up @@ -190,7 +193,7 @@ describe('HashLockHttp', () => {
describe('Restore test multisig Accounts', () => {
it('Announce MultisigAccountModificationTransaction', () => {
const removeCosigner1 = MultisigAccountModificationTransaction.create(
Deadline.create(),
Deadline.create(epochAdjustment),
-1,
0,
[],
Expand All @@ -199,7 +202,7 @@ describe('HashLockHttp', () => {
helper.maxFee,
);
const removeCosigner2 = MultisigAccountModificationTransaction.create(
Deadline.create(),
Deadline.create(epochAdjustment),
0,
0,
[],
Expand All @@ -209,7 +212,7 @@ describe('HashLockHttp', () => {
);

const removeCosigner3 = MultisigAccountModificationTransaction.create(
Deadline.create(),
Deadline.create(epochAdjustment),
-1,
-1,
[],
Expand All @@ -219,7 +222,7 @@ describe('HashLockHttp', () => {
);

const aggregateTransaction = AggregateTransaction.createComplete(
Deadline.create(),
Deadline.create(epochAdjustment),
[
removeCosigner1.toAggregate(multisigAccount.publicAccount),
removeCosigner2.toAggregate(multisigAccount.publicAccount),
Expand Down
3 changes: 3 additions & 0 deletions e2e/infrastructure/IntegrationTestHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { SignedTransaction } from '../../src/model/transaction/SignedTransaction
import { Transaction } from '../../src/model/transaction/Transaction';
import { UInt64 } from '../../src/model/UInt64';
import { TransactionService } from '../../src/service/TransactionService';
import { Duration } from 'js-joda';

export class IntegrationTestHelper {
public apiUrl: string;
Expand All @@ -52,6 +53,7 @@ export class IntegrationTestHelper {
public service = new BootstrapService();
public config: StartParams;
public startEachTime = true;
public epochAdjustment: Duration;

private async startBootstrapServer(): Promise<{ accounts: string[]; apiUrl: string }> {
this.config = {
Expand Down Expand Up @@ -112,6 +114,7 @@ export class IntegrationTestHelper {

this.networkType = await this.repositoryFactory.getNetworkType().toPromise();
this.generationHash = await this.repositoryFactory.getGenerationHash().toPromise();
this.epochAdjustment = await this.repositoryFactory.getEpochAdjustment().toPromise();

let index = 0;
this.account = Account.createFromPrivateKey(accounts[index++], this.networkType);
Expand Down
Loading