Skip to content

Commit

Permalink
Improve xcm ump dancelight test
Browse files Browse the repository at this point in the history
  • Loading branch information
dimartiro committed Dec 23, 2024
1 parent 85de0a9 commit fb92948
Showing 1 changed file with 10 additions and 32 deletions.
42 changes: 10 additions & 32 deletions test/suites/dev-tanssi-relay/xcm/test-xcm-send-upward.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { beforeAll, customDevRpcRequest, describeSuite, expect } from "@moonwall/cli";
import { KeyringPair } from "@moonwall/util";
import { ApiPromise, Keyring } from "@polkadot/api";
import { u8aToHex } from "@polkadot/util";
import { beforeAll, customDevRpcRequest, describeSuite } from "@moonwall/cli";
import { ApiPromise } from "@polkadot/api";
import { jumpToSession } from "util/block";
import { injectUmpMessageAndSeal, RawXcmMessage, XcmFragment } from "../../../util/xcm";

Expand All @@ -12,16 +10,9 @@ describeSuite({
foundationMethods: "dev",
testCases: ({ context, it }) => {
let polkadotJs: ApiPromise;
let alice: KeyringPair;
let transferredBalance;

beforeAll(async function () {
polkadotJs = context.polkadotJs();
alice = new Keyring({ type: "sr25519" }).addFromUri("//Alice", {
name: "Alice default",
});

transferredBalance = 10_000_000_000_000n;
});

it({
Expand All @@ -30,20 +21,10 @@ describeSuite({
test: async function () {
// Basic xcm message
const xcmMessage = new XcmFragment({
assets: [
{
multilocation: {
parents: 0,
interior: { Here: null },
},
fungible: transferredBalance,
},
],
beneficiary: u8aToHex(alice.addressRaw),
assets: [],
})
.withdraw_asset()
.clear_origin()
.as_v3();
.clear_origin()
.as_v3();

// Enable para inherent to process xcm message
await customDevRpcRequest("mock_enableParaInherentCandidate", []);
Expand All @@ -59,17 +40,14 @@ describeSuite({
await context.createBlock();

// Check message was processed ok
const events = await polkadotJs.query.system.events();

const xcmEvent = events.find((event) => {
console.log("Event", event)

const events = await polkadotJs.query.system.events()

return event.event.section === 'xcmpQueue' &&
event.event.method === 'Success'
const processedEvent = events.find((event) => {
return event.event.section === 'messageQueue' &&
event.event.method === 'Processed'
});

expect(xcmEvent).to.not.be.undefined;
expect(processedEvent).to.not.be.undefined;
},
});
},
Expand Down

0 comments on commit fb92948

Please sign in to comment.