Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mmaurello committed Oct 14, 2024
1 parent acd0160 commit 0e92590
Show file tree
Hide file tree
Showing 2 changed files with 138 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,127 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`polkadotXcm > send > should be correct config 1`] = `
exports[`polkadotXcm > send with transferMulticurrencies > should be correct config 1`] = `
ExtrinsicConfig {
"func": "batchAll",
"getArgs": [Function],
"module": "utility",
}
`;

exports[`polkadotXcm > send > should get correct arguments 1`] = `
exports[`polkadotXcm > send with transferMulticurrencies > should get correct arguments 1`] = `
[
[
"xTokens.transferMulticurrencies => RESULT",
"polkadotXcm.send => RESULT",
],
]
`;

exports[`polkadotXcm > send with transferMulticurrencies > should get correct arguments 2`] = `
[
{
"V3": {
"interior": {
"X1": {
"Parachain": 1000,
},
},
"parents": 1,
},
},
{
"V3": [
{
"WithdrawAsset": [
{
"fun": {
"Fungible": 100000000000000000n,
},
"id": {
"Concrete": {
"interior": {
"X1": {
"PalletInstance": 10,
},
},
"parents": 0,
},
},
},
],
},
{
"BuyExecution": {
"fees": {
"fun": {
"Fungible": 100000000000000000n,
},
"id": {
"Concrete": {
"interior": {
"X1": {
"PalletInstance": 10,
},
},
"parents": 0,
},
},
},
"weightLimit": "Unlimited",
},
},
{
"Transact": {
"call": {
"encoded": "0x4d79207465787420737472696e67",
},
"originKind": "SovereignAccount",
"requireWeightAtMost": {
"proofSize": 62193n,
"refTime": 24902375000n,
},
},
},
{
"SetAppendix": [
{
"RefundSurplus": {},
},
{
"DepositAsset": {
"assets": {
"Wild": {
"AllCounted": 1,
},
},
"beneficiary": {
"interior": {
"X1": {
"AccountKey20": {
"key": "0xcd93e4dcf4e6bb23f1c58109113266e9b79cd844",
},
},
},
"parents": 0,
},
},
},
],
},
],
},
]
`;

exports[`polkadotXcm > send with transfers > should be correct config 1`] = `
ExtrinsicConfig {
"func": "batchAll",
"getArgs": [Function],
"module": "utility",
}
`;

exports[`polkadotXcm > send with transfers > should get correct arguments 1`] = `
[
[
"xTokens.transfer => RESULT",
Expand All @@ -18,7 +131,7 @@ exports[`polkadotXcm > send > should get correct arguments 1`] = `
]
`;

exports[`polkadotXcm > send > should get correct arguments 2`] = `
exports[`polkadotXcm > send with transfers > should get correct arguments 2`] = `
[
{
"V3": {
Expand Down Expand Up @@ -99,7 +212,7 @@ exports[`polkadotXcm > send > should get correct arguments 2`] = `
"interior": {
"X1": {
"AccountKey20": {
"key": "0x88275533b5d43292c86d05985c3a6e226fee2bae",
"key": "0xcd93e4dcf4e6bb23f1c58109113266e9b79cd844",
},
},
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { describe, expect, it, vi } from 'vitest';

import { apiMock, mrlBuildParamsMock } from '../../../../../../fixtures';
import {
apiMock,
mrlBuildParamsMock,
mrlBuildParamsSameAssetMock,
} from '../../../../../../fixtures';
import type { ExtrinsicConfig } from '../../../../../extrinsic';
import { XcmVersion } from '../../../../../extrinsic/ExtrinsicBuilder.interfaces';
import { polkadotXcm } from './polkadotXcm';
Expand All @@ -18,7 +22,7 @@ vi.mock(
);

describe('polkadotXcm', () => {
describe('send', () => {
describe('send with transferMulticurrencies', () => {
const extrinsic = polkadotXcm()
.send()
.build(mrlBuildParamsMock) as ExtrinsicConfig;
Expand All @@ -32,4 +36,19 @@ describe('polkadotXcm', () => {
expect(apiMock.tx.polkadotXcm.send.mock.lastCall).toMatchSnapshot();
});
});

describe('send with transfers', () => {
const extrinsic = polkadotXcm()
.send()
.build(mrlBuildParamsSameAssetMock) as ExtrinsicConfig;

it('should be correct config', () => {
expect(extrinsic).toMatchSnapshot();
});

it('should get correct arguments', () => {
expect(extrinsic.getArgs({} as any)).toMatchSnapshot();
expect(apiMock.tx.polkadotXcm.send.mock.lastCall).toMatchSnapshot();
});
});
});

0 comments on commit 0e92590

Please sign in to comment.