Skip to content

Commit

Permalink
duplicate tests for starship
Browse files Browse the repository at this point in the history
  • Loading branch information
Zetazzz committed Dec 25, 2023
1 parent 11e57b2 commit 937294f
Show file tree
Hide file tree
Showing 9 changed files with 561 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import Long from 'long';
import { DirectSecp256k1HdWallet } from '@cosmjs/proto-signing';
import BigNumber from 'bignumber.js';

import { cosmos, getSigningOsmosisClient } from '../src/codegen';
import { useChain, waitUntil } from '../src';
import { cosmos, getSigningOsmosisClient } from '../../src/codegen';
import { useChain, waitUntil } from '../../src';
import './setup.test';

describe('Governance tests for osmosis', () => {
Expand Down Expand Up @@ -47,7 +47,7 @@ describe('Governance tests for osmosis', () => {
});

expect(balance.amount).toEqual('10000000000');
}, 10000);
}, 200000);

it('query validator address', async () => {
const { validators } = await queryClient.cosmos.staking.v1beta1.validators({
Expand All @@ -66,7 +66,7 @@ describe('Governance tests for osmosis', () => {

// set validator address to the first one
validatorAddress = allValidators[0].operatorAddress;
});
}, 200000);

it('stake tokens to genesis validator', async () => {
const signingClient = await getSigningOsmosisClient({
Expand Down Expand Up @@ -103,7 +103,7 @@ describe('Governance tests for osmosis', () => {

const result = await signingClient.signAndBroadcast(address, [msg], fee);
assertIsDeliverTxSuccess(result);
}, 10000);
}, 200000);

it('submit a txt proposal', async () => {
const signingClient = await getSigningOsmosisClient({
Expand Down Expand Up @@ -162,7 +162,7 @@ describe('Governance tests for osmosis', () => {
});

expect(result.proposal.proposalId.toString()).toEqual(proposalId);
}, 10000);
}, 200000);

it('vote on proposal from genesis address', async () => {
// create genesis address signing client
Expand Down Expand Up @@ -190,7 +190,7 @@ describe('Governance tests for osmosis', () => {

const result = await signingClient.signAndBroadcast(address, [msg], fee);
assertIsDeliverTxSuccess(result);
}, 10000);
}, 200000);

it('verify vote', async () => {
const { vote } = await queryClient.cosmos.gov.v1beta1.vote({
Expand All @@ -201,7 +201,7 @@ describe('Governance tests for osmosis', () => {
expect(vote.proposalId.toString()).toEqual(proposalId);
expect(vote.voter).toEqual(address);
expect(vote.option).toEqual(cosmos.gov.v1beta1.VoteOption.VOTE_OPTION_YES);
}, 10000);
}, 200000);

it('wait for voting period to end', async () => {
// wait for the voting period to end
Expand All @@ -220,5 +220,5 @@ describe('Governance tests for osmosis', () => {
expect(proposal.status).toEqual(
cosmos.gov.v1beta1.ProposalStatus.PROPOSAL_STATUS_PASSED
);
}, 10000);
}, 200000);
});
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import path from 'path';

import { Config, useChain, useRegistry } from '../src';
import { Config, useChain, useRegistry } from '../../src';

beforeAll(async () => {
const configFile = path.join(__dirname, '..', 'configs', 'config.yaml');
const configFile = path.join(__dirname, '../..', 'configs', 'config.yaml');
Config.setConfigFile = configFile;
Config.setRegistry = await useRegistry(configFile);
});
}, 200000);

describe('Test clients', () => {
let client;

beforeAll(async () => {
const { getStargateClient } = useChain('osmosis');
client = await getStargateClient();
});
}, 200000);

it('check chain height', async () => {
const height = await client.getHeight();

expect(height).toBeGreaterThan(0);
});
}, 200000);
});
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { assertIsDeliverTxSuccess } from '@cosmjs/stargate';
import { DirectSecp256k1HdWallet } from '@cosmjs/proto-signing';
import BigNumber from 'bignumber.js';

import { cosmos, getSigningOsmosisClient } from '../src/codegen';
import { useChain } from '../src';
import { cosmos, getSigningOsmosisClient } from '../../src/codegen';
import { useChain } from '../../src';
import './setup.test';

describe('Staking tokens testing', () => {
Expand Down Expand Up @@ -48,7 +48,7 @@ describe('Staking tokens testing', () => {
});

expect(balance.amount).toEqual('10000000000');
}, 10000);
}, 200000);

it('query validator address', async () => {
const { validators } = await queryClient.cosmos.staking.v1beta1.validators({
Expand All @@ -67,7 +67,7 @@ describe('Staking tokens testing', () => {

// set validator address to the first one
validatorAddress = allValidators[0].operatorAddress;
});
}, 200000);

it('stake tokens to genesis validator', async () => {
const signingClient = await getSigningOsmosisClient({
Expand Down Expand Up @@ -104,7 +104,7 @@ describe('Staking tokens testing', () => {

const result = await signingClient.signAndBroadcast(address, [msg], fee);
assertIsDeliverTxSuccess(result);
});
}, 200000);

it('query delegation', async () => {
const { delegationResponse } =
Expand All @@ -121,5 +121,5 @@ describe('Staking tokens testing', () => {
);
expect(delegationResponse.balance.amount).toEqual(delegationAmount);
expect(delegationResponse.balance.denom).toEqual(denom);
});
}, 200000);
});
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { generateMnemonic } from '@confio/relayer/build/lib/helpers';
import { DirectSecp256k1HdWallet } from '@cosmjs/proto-signing';
import { assertIsDeliverTxSuccess } from '@cosmjs/stargate';

import { ibc, getSigningOsmosisClient } from '../src/codegen';
import { useChain } from '../src';
import { ibc, getSigningOsmosisClient } from '../../src/codegen';
import { useChain } from '../../src';
import './setup.test';

describe('Token transfers', () => {
Expand All @@ -27,7 +27,7 @@ describe('Token transfers', () => {
address = (await wallet.getAccounts())[0].address;

await creditFromFaucet(address);
});
}, 200000);

it('send osmosis token to address', async () => {
// Initialize wallet
Expand Down Expand Up @@ -70,7 +70,7 @@ describe('Token transfers', () => {

expect(balance.amount).toEqual(token.amount);
expect(balance.denom).toEqual(denom);
}, 10000);
}, 200000);

it('send ibc osmo tokens to address on cosmos chain', async () => {
const signingClient = await getSigningOsmosisClient({
Expand Down Expand Up @@ -157,6 +157,6 @@ describe('Token transfers', () => {
const trace = await queryClient.ibc.applications.transfer.v1.denomTrace({
hash: ibcBalance!.denom.replace('ibc/', '')
});
expect(trace.denomTrace.baseDenom).toEqual(denom);
}, 10000);
expect(trace?.denomTrace?.baseDenom).toEqual(denom);
}, 200000);
});
Loading

0 comments on commit 937294f

Please sign in to comment.