-
Notifications
You must be signed in to change notification settings - Fork 358
/
Copy pathtest-referenda-general-admin.ts
63 lines (57 loc) · 2.08 KB
/
test-referenda-general-admin.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import "@moonbeam-network/api-augment";
import { beforeAll, describeSuite, expect, proposeReferendaAndDeposit } from "@moonwall/cli";
import { alith } from "@moonwall/util";
import "@polkadot/api-augment";
describeSuite({
id: "D010904",
title: "Referenda - GeneralAdmin",
foundationMethods: "dev",
testCases: ({ context, it }) => {
let refIndex: number;
let proposalHash: string;
beforeAll(async () => {
// Just build the arguments. They dont matter that much though, since
// we will not make sure it executes in the relay
const transactWeights = context
.polkadotJs()
.createType("PalletXcmTransactorTransactWeights", {
transactRequiredWeightAtMost: { refTime: 10000, proofSize: 10000 },
overallWeight: { Limited: { refTime: 10000, proofSize: 10000 } },
});
const fee = context.polkadotJs().createType("PalletXcmTransactorCurrencyPayment", {
currency: {
AsMultiLocation: {
V3: {
parents: 1,
interior: {
Here: null,
},
},
},
},
feeAmount: 10000,
});
// The proposal itself
const proposal = (context.polkadotJs().tx.xcmTransactor as any).hrmpManage(
{ Accept: { para_id: 2000 } },
fee,
transactWeights
);
// The origin we want to use, post a referenda and deposit.
[refIndex, proposalHash] = await proposeReferendaAndDeposit(context, alith, proposal, {
Origins: "GeneralAdmin",
});
});
it({
id: "T01",
title: "generalAdmin origin should match to general admin track",
test: async function () {
const refInfo = await context.polkadotJs().query.referenda.referendumInfoFor(refIndex);
const track = refInfo.unwrap().asOngoing.track.toString();
const tracks = context.polkadotJs().consts.referenda.tracks;
const trackName = tracks.find(([index, info]) => index.toString() == track)![1].name;
expect(trackName.toString()).to.be.eq("general_admin");
},
});
},
});