Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: run state channel tests on testnet #1924

Merged
merged 3 commits into from
Jun 12, 2024
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
2 changes: 1 addition & 1 deletion .mocharc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ module.exports = {
require: 'tooling/babel-register.js',
recursive: true,
extension: '.js,.ts',
timeout: process.env.NETWORK ? '500s' : '6s',
timeout: process.env.NETWORK ? '30s' : '6s',
ignore: 'test/environment/**',
}
16 changes: 8 additions & 8 deletions test/integration/aens.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, it, before } from 'mocha';
import { expect } from 'chai';
import { RestError } from '@azure/core-rest-pipeline';
import { getSdk, isLimitedCoins } from '.';
import { getSdk, isLimitedCoins, timeoutBlock } from '.';
import {
assertNotNull, ensureEqual, randomName, randomString,
} from '../utils';
Expand Down Expand Up @@ -51,7 +51,7 @@ describe('Aens', () => {
assertNotNull(claimRes.tx);
assertNotNull(claimRes.signatures);
expect(claimRes.tx.fee).to.satisfy((fee: bigint) => fee >= 16660000000000n);
expect(claimRes.tx.fee).to.satisfy((fee: bigint) => fee <= 17040000000000n);
expect(claimRes.tx.fee).to.satisfy((fee: bigint) => fee <= 17080000000000n);
expect(claimRes).to.be.eql({
tx: {
fee: claimRes.tx.fee,
Expand Down Expand Up @@ -79,7 +79,7 @@ describe('Aens', () => {
pointers: [],
ttl: claimRes.blockHeight + 180000,
});
});
}).timeout(timeoutBlock);

it('claims a long name without preclaim', async () => {
const nameString = randomName(30);
Expand Down Expand Up @@ -136,7 +136,7 @@ describe('Aens', () => {
pointers: [],
ttl: claimRes.blockHeight + 180000,
});
});
}).timeout(timeoutBlock);

it('preclaims name using specific account', async () => {
const onAccount = Object.values(aeSdk.accounts)[1];
Expand Down Expand Up @@ -241,7 +241,7 @@ describe('Aens', () => {
assertNotNull(updateRes.tx);
assertNotNull(updateRes.signatures);
expect(updateRes.tx.fee).to.satisfy((fee: bigint) => fee >= 22140000000000n);
expect(updateRes.tx.fee).to.satisfy((fee: bigint) => fee <= 22180000000000n);
expect(updateRes.tx.fee).to.satisfy((fee: bigint) => fee <= 22240000000000n);
expect(updateRes).to.be.eql({
tx: {
fee: updateRes.tx.fee,
Expand Down Expand Up @@ -280,7 +280,7 @@ describe('Aens', () => {
const txHash = buildTxHash(rawTx);
await expect(aeSdk.poll(txHash))
.to.be.rejectedWith(new RegExp(`v3/transactions/${txHash} error: (Transaction not found|412 status code)`));
});
}).timeout(timeoutBlock);

it('updates extending pointers', async () => {
const anotherContract = buildContractId(address, 12);
Expand Down Expand Up @@ -331,7 +331,7 @@ describe('Aens', () => {
assertNotNull(transferRes.tx);
assertNotNull(transferRes.signatures);
expect(transferRes.tx.fee).to.satisfy((fee: bigint) => fee >= 17300000000000n);
expect(transferRes.tx.fee).to.satisfy((fee: bigint) => fee <= 17340000000000n);
expect(transferRes.tx.fee).to.satisfy((fee: bigint) => fee <= 17400000000000n);
expect(transferRes).to.be.eql({
tx: {
fee: transferRes.tx.fee,
Expand Down Expand Up @@ -359,7 +359,7 @@ describe('Aens', () => {
assertNotNull(revokeRes.tx);
assertNotNull(revokeRes.signatures);
expect(revokeRes.tx.fee).to.satisfy((fee: bigint) => fee >= 16620000000000n);
expect(revokeRes.tx.fee).to.satisfy((fee: bigint) => fee <= 16660000000000n);
expect(revokeRes.tx.fee).to.satisfy((fee: bigint) => fee <= 16700000000000n);
expect(revokeRes).to.be.eql({
tx: {
fee: revokeRes.tx.fee,
Expand Down
6 changes: 3 additions & 3 deletions test/integration/chain.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, it, before } from 'mocha';
import { expect } from 'chai';
import { stub } from 'sinon';
import { getSdk } from '.';
import { getSdk, timeoutBlock } from '.';
import {
generateKeyPair, AeSdk, Tag, MemoryAccount, Encoded, Node, Contract,
} from '../../src';
Expand Down Expand Up @@ -62,7 +62,7 @@ describe('Node Chain', () => {
const target = await aeSdkWithoutAccount.getHeight() + 1;
await aeSdkWithoutAccount.awaitHeight(target).should.eventually.be.at.least(target);
await aeSdkWithoutAccount.getHeight().should.eventually.be.at.least(target);
});
}).timeout(timeoutBlock);

it('Can verify transaction from broadcast error', async () => {
const error = await aeSdk
Expand Down Expand Up @@ -114,7 +114,7 @@ describe('Node Chain', () => {
const res = await aeSdk.spend(1000, aeSdk.address, { confirm: 1 });
assertNotNull(res.blockHeight);
expect(await aeSdk.getHeight() >= res.blockHeight + 1).to.be.equal(true);
});
}).timeout(timeoutBlock);

it('doesn\'t make extra requests', async () => {
let getCount;
Expand Down
Loading