Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
Szegoo committed May 26, 2024
1 parent b068416 commit d6578e2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion e2e_tests/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,5 +132,5 @@ export {
submitExtrinsic,
transferRelayAssetToPara,
getAddressFromModuleId,
getFreeBalance
getFreeBalance,
};
11 changes: 10 additions & 1 deletion e2e_tests/xc-transfer/region-transfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ async function run(_nodeName: any, networkInfo: any, _jsArgs: any) {
const txSetBalance = coretimeApi.tx.balances.forceSetBalance(alice.address, 1000 * UNIT);
await submitExtrinsic(alice, coretimeApi.tx.sudo.sudo(txSetBalance), {});

await ismpAddParachain(alice, regionXApi);

const regionId = await purchaseRegion(coretimeApi, alice);
if (!regionId) throw new Error('RegionId not found');

Expand Down Expand Up @@ -108,7 +110,8 @@ async function run(_nodeName: any, networkInfo: any, _jsArgs: any) {
assert.equal(regions.length, 1);
assert.deepStrictEqual(regions[0][0].toHuman(), [regionId]);
// record is unavailable because we did not setup ismp.
assert.deepStrictEqual(regions[0][1].toHuman(), { owner: alice.address, record: 'Unavailable' });
assert((regions[0][1].toHuman() as any).owner == alice.address);
assert(typeof (regions[0][1].toHuman() as any).record.Pending === 'string');

regions = await coretimeApi.query.broker.regions.entries();
assert.equal(regions.length, 1);
Expand Down Expand Up @@ -174,6 +177,12 @@ async function run(_nodeName: any, networkInfo: any, _jsArgs: any) {
assert.equal((regions[0][1].toHuman() as any).owner, alice.address);
}

async function ismpAddParachain(signer: KeyringPair, regionXApi: ApiPromise) {
const addParaCall = regionXApi.tx.ismpParachain.addParachain([1005]);
const sudoCall = regionXApi.tx.sudo.sudo(addParaCall);
return submitExtrinsic(signer, sudoCall, {});
}

async function openHrmpChannel(
signer: KeyringPair,
relayApi: ApiPromise,
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"@jest/globals": "^29.7.0",
"@polkadot/api": "^11.0.2",
"@polkadot/keyring": "^12.6.2",
"@polkadot/util": "^12.6.2",
Expand Down

0 comments on commit d6578e2

Please sign in to comment.