Skip to content

Commit

Permalink
tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
timbrinded committed Jan 29, 2025
1 parent 9464f84 commit 95b0139
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions test/helpers/xcm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -871,21 +871,12 @@ export const registerXcmTransactorDerivativeIndex = async (context: DevModeConte
export const expectXcmEventMessage = async (context: DevModeContext, message: string) => {
const records = await context.polkadotJs().query.system.events();

const filteredEvents = records
.map(({ event }) => (context.polkadotJs().events.xcmpQueue.Fail.is(event) ? event : undefined))
.filter((event) => event);

const filtered = filteredEvents[0];

if (!filtered) {
return false;
}

return (
context.polkadotJs().events.xcmpQueue.Fail.is(filtered) &&
// @ts-expect-error xcmpQueue.Fail isn't coming up as an event
filtered.data.error.toString() === message
);
return records
.filter(({ event }) => context.polkadotJs().events.xcmpQueue.Fail.is(event))
.some(
({ event: { data: eventData } }: { event: { data: any } }) =>
eventData.error.toString() === message
);
};

type XcmCallback = (this: XcmFragment) => void;

0 comments on commit 95b0139

Please sign in to comment.