Skip to content

Commit

Permalink
Update test with new package
Browse files Browse the repository at this point in the history
  • Loading branch information
albertandrejev committed Aug 1, 2023
1 parent d14679e commit f29071f
Show file tree
Hide file tree
Showing 25 changed files with 58 additions and 89 deletions.
2 changes: 1 addition & 1 deletion globalSetup.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { env } from 'neutronjs';
import { env } from '@neutron-org/neutronjs';

export default async () => {
const host1 = process.env.NODE1_URL || 'http://localhost:1317';
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"@cosmos-client/core": "0.45.13",
"@cosmos-client/cosmwasm": "^0.20.1",
"@cosmos-client/ibc": "^1.2.1",
"@neutron-org/neutronjs": "^0.0.4",
"@types/lodash": "^4.14.182",
"@types/long": "^4.0.2",
"axios": "^0.27.2",
Expand All @@ -51,7 +52,6 @@
"lodash": "^4.17.21",
"long": "^5.2.1",
"merkletreejs": "^0.3.9",
"neutronjs": "file:../neutronjs",
"yesno": "^0.4.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion src/testcases/parallel/dao_assert.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
NEUTRON_DENOM,
TestStateLocalCosmosTestNet,
types,
} from 'neutronjs';
} from '@neutron-org/neutronjs';

const config = require('../../config.json');

Expand Down
2 changes: 1 addition & 1 deletion src/testcases/parallel/governance.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
TestStateLocalCosmosTestNet,
types,
wait,
} from 'neutronjs';
} from '@neutron-org/neutronjs';

const config = require('../../config.json');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
NEUTRON_DENOM,
TestStateLocalCosmosTestNet,
types,
} from 'neutronjs';
} from '@neutron-org/neutronjs';

const config = require('../../config.json');

Expand Down
2 changes: 1 addition & 1 deletion src/testcases/parallel/overrule.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
dao,
NEUTRON_DENOM,
TestStateLocalCosmosTestNet,
} from 'neutronjs';
} from '@neutron-org/neutronjs';

const config = require('../../config.json');

Expand Down
2 changes: 1 addition & 1 deletion src/testcases/parallel/simple.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
TestStateLocalCosmosTestNet,
types,
wait,
} from 'neutronjs';
} from '@neutron-org/neutronjs';

const config = require('../../config.json');

Expand Down
48 changes: 25 additions & 23 deletions src/testcases/parallel/stargate_queries.test.ts
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
import Long from 'long';
import {
CosmosWrapper,
cosmosWrapper,
COSMOS_DENOM,
NEUTRON_DENOM,
WalletWrapper,
getEventAttribute,
} from '../../helpers/cosmos';
import { NeutronContract } from '../../helpers/types';
import { msgCreateDenom } from '../../helpers/tokenfactory';

import { TestStateLocalCosmosTestNet } from '../common_localcosmosnet';
import { CodeId } from '../../types';
TestStateLocalCosmosTestNet,
tokenfactory,
types,
} from '@neutron-org/neutronjs';
import Long from 'long';

const config = require('../../config.json');
describe('Neutron / Simple', () => {
let testState: TestStateLocalCosmosTestNet;
let neutronChain: CosmosWrapper;
let neutronAccount: WalletWrapper;
let neutronChain: cosmosWrapper.CosmosWrapper;
let neutronAccount: cosmosWrapper.WalletWrapper;
let contractAddress: string;

let gaiaChain: CosmosWrapper;
let gaiaAccount: WalletWrapper;
let gaiaChain: cosmosWrapper.CosmosWrapper;
let gaiaAccount: cosmosWrapper.WalletWrapper;

let newTokenDenom: string;

beforeAll(async () => {
testState = new TestStateLocalCosmosTestNet();
cosmosWrapper.registerCodecs();
tokenfactory.registerCodecs();

testState = new TestStateLocalCosmosTestNet(config);
await testState.init();
neutronChain = new CosmosWrapper(
neutronChain = new cosmosWrapper.CosmosWrapper(
testState.sdk1,
testState.blockWaiter1,
NEUTRON_DENOM,
);
neutronAccount = new WalletWrapper(
neutronAccount = new cosmosWrapper.WalletWrapper(
neutronChain,
testState.wallets.qaNeutron.genQaWal1,
);

gaiaChain = new CosmosWrapper(
gaiaChain = new cosmosWrapper.CosmosWrapper(
testState.sdk2,
testState.blockWaiter2,
COSMOS_DENOM,
);
gaiaAccount = new WalletWrapper(
gaiaAccount = new cosmosWrapper.WalletWrapper(
gaiaChain,
testState.wallets.qaCosmos.genQaWal1,
);
Expand All @@ -65,12 +65,12 @@ describe('Neutron / Simple', () => {
test('create denom, mint', async () => {
const denom = `teststargate`;

const data = await msgCreateDenom(
const data = await tokenfactory.msgCreateDenom(
neutronAccount,
neutronAccount.wallet.address.toString(),
denom,
);
newTokenDenom = getEventAttribute(
newTokenDenom = cosmosWrapper.getEventAttribute(
(data as any).events,
'create_denom',
'new_token_denom',
Expand All @@ -79,9 +79,11 @@ describe('Neutron / Simple', () => {
});

describe('Contract instantiation', () => {
let codeId: CodeId;
let codeId: types.CodeId;
test('store contract', async () => {
codeId = await neutronAccount.storeWasm(NeutronContract.STARGATE_QUERIER);
codeId = await neutronAccount.storeWasm(
types.NeutronContract.STARGATE_QUERIER,
);
expect(codeId).toBeGreaterThan(0);
});
test('instantiate', async () => {
Expand Down
2 changes: 1 addition & 1 deletion src/testcases/parallel/subdao.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
TestStateLocalCosmosTestNet,
types,
wait,
} from 'neutronjs';
} from '@neutron-org/neutronjs';

const config = require('../../config.json');

Expand Down
2 changes: 1 addition & 1 deletion src/testcases/parallel/tge.credits_vault.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
TestStateLocalCosmosTestNet,
types,
wait,
} from 'neutronjs';
} from '@neutron-org/neutronjs';

const config = require('../../config.json');

Expand Down
2 changes: 1 addition & 1 deletion src/testcases/parallel/tge.investors_vesting_vault.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
TestStateLocalCosmosTestNet,
types,
wait,
} from 'neutronjs';
} from '@neutron-org/neutronjs';

const INVESTORS_VESTING_CONTRACT_KEY = 'VESTING_INVESTORS';
const INVESTORS_VESTING_VAULT_CONTRACT_KEY = 'INVESTORS_VESTING_VAULT';
Expand Down
2 changes: 1 addition & 1 deletion src/testcases/parallel/tge.vesting_lp_vault.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
TestStateLocalCosmosTestNet,
types,
wait,
} from 'neutronjs';
} from '@neutron-org/neutronjs';

// general contract keys used across the tests
const ASTRO_PAIR_CONTRACT_KEY = 'ASTRO_PAIR';
Expand Down
2 changes: 1 addition & 1 deletion src/testcases/parallel/tokenfactory.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
TestStateLocalCosmosTestNet,
tokenfactory,
types,
} from 'neutronjs';
} from '@neutron-org/neutronjs';

const config = require('../../config.json');

Expand Down
2 changes: 1 addition & 1 deletion src/testcases/run_in_band/globalfee.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
NEUTRON_DENOM,
TestStateLocalCosmosTestNet,
wait,
} from 'neutronjs';
} from '@neutron-org/neutronjs';

const config = require('../../config.json');

Expand Down
2 changes: 1 addition & 1 deletion src/testcases/run_in_band/ibc_hooks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
NEUTRON_DENOM,
TestStateLocalCosmosTestNet,
types,
} from 'neutronjs';
} from '@neutron-org/neutronjs';

const config = require('../../config.json');

Expand Down
2 changes: 1 addition & 1 deletion src/testcases/run_in_band/interchain_kv_query.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
TestStateLocalCosmosTestNet,
types,
wait,
} from 'neutronjs';
} from '@neutron-org/neutronjs';

const getKvCallbackStatus = (
cm: cosmosWrapper.CosmosWrapper,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
NEUTRON_DENOM,
TestStateLocalCosmosTestNet,
types,
} from 'neutronjs';
} from '@neutron-org/neutronjs';

const config = require('../../config.json');

Expand Down
2 changes: 1 addition & 1 deletion src/testcases/run_in_band/interchaintx.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
TestStateLocalCosmosTestNet,
types,
wait,
} from 'neutronjs';
} from '@neutron-org/neutronjs';

const config = require('../../config.json');

Expand Down
2 changes: 1 addition & 1 deletion src/testcases/run_in_band/reserve.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
NEUTRON_DENOM,
TestStateLocalCosmosTestNet,
types,
} from 'neutronjs';
} from '@neutron-org/neutronjs';

const config = require('../../config.json');
interface ReserveStats {
Expand Down
2 changes: 1 addition & 1 deletion src/testcases/run_in_band/tge.airdrop.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
TestStateLocalCosmosTestNet,
tge,
types,
} from 'neutronjs';
} from '@neutron-org/neutronjs';

const config = require('../../config.json');

Expand Down
2 changes: 1 addition & 1 deletion src/testcases/run_in_band/tge.auction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
tokenfactory,
types,
wait,
} from 'neutronjs';
} from '@neutron-org/neutronjs';

const MIN_LIQUDITY = 1000;
const ATOM_DEPOSIT_AMOUNT = 10000;
Expand Down
2 changes: 1 addition & 1 deletion src/testcases/run_in_band/tge.credits.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
TestStateLocalCosmosTestNet,
types,
wait,
} from 'neutronjs';
} from '@neutron-org/neutronjs';

const getTimestamp = (secondsFromNow: number): number =>
(Date.now() / 1000 + secondsFromNow) | 0;
Expand Down
2 changes: 1 addition & 1 deletion src/testcases/run_in_band/tokenomics.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
NEUTRON_DENOM,
TestStateLocalCosmosTestNet,
wait,
} from 'neutronjs';
} from '@neutron-org/neutronjs';

const config = require('../../config.json');
describe('Neutron / Tokenomics', () => {
Expand Down
35 changes: 0 additions & 35 deletions src/types.ts

This file was deleted.

20 changes: 11 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1591,6 +1591,17 @@
"@jridgewell/resolve-uri" "^3.0.3"
"@jridgewell/sourcemap-codec" "^1.4.10"

"@neutron-org/neutronjs@^0.0.4":
version "0.0.4"
resolved "https://registry.yarnpkg.com/@neutron-org/neutronjs/-/neutronjs-0.0.4.tgz#c9de82542e2b1515db6e62c92e29c604be72d8d6"
integrity sha512-RB8aoj5WLW1qgpRZSguJxb0UXcjUy71mgewp81nBquiqtOvSBdFegP0qKwVE056We+cMSWPR2CpGSdnDIjap8w==
dependencies:
"@cosmos-client/core" "0.45.13"
"@cosmos-client/cosmwasm" "^0.20.1"
"@cosmos-client/ibc" "^1.2.1"
axios "^0.27.2"
merkletreejs "^0.3.9"

"@nodelib/[email protected]":
version "2.1.5"
resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5"
Expand Down Expand Up @@ -4615,15 +4626,6 @@ [email protected]:
resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.3.tgz#58e323a72fedc0d6f9cd4d31fe49f51479590ccd"
integrity sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==

"neutronjs@file:../neutronjs":
version "0.0.1"
dependencies:
"@cosmos-client/core" "0.45.13"
"@cosmos-client/cosmwasm" "^0.20.1"
"@cosmos-client/ibc" "^1.2.1"
axios "^0.27.2"
merkletreejs "^0.3.9"

node-addon-api@^2.0.0:
version "2.0.2"
resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-2.0.2.tgz#432cfa82962ce494b132e9d72a15b29f71ff5d32"
Expand Down

0 comments on commit f29071f

Please sign in to comment.