Skip to content

Commit a023900

Browse files
committed
Add tests for PreImage (continued)
Add additional tests which verify PreImage behavior: - 1) A manager account requests a preimage hash once then unrequests it multiple times (added additional checks) - 2) Check the noting and unnoting of empty images - 3) Check the noting and unnoting of oversized images - 4) Check the repeated noting and unnoting of the same preimage - 5) Check preimage behavior when requesting, noting, unrequesting and unnoting occur in different orders - 6) Check the "ensure_updated" extrinsic applies fees depending on the update ratio Several utility functions have been moved to the helpers file as they are shared with other test files. This is a continuation of the PR: #470. Also address outstanding comments from the original PR.
1 parent 58db7cd commit a023900

File tree

6 files changed

+947
-71
lines changed

6 files changed

+947
-71
lines changed

packages/kusama/src/__snapshots__/assetHubKusama.preimage.e2e.test.ts.snap

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,33 @@
11
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
22

3+
exports[`Kusama Asset Hub PreImage > Kusama Asset Hub PreImage > preimage tests > preimage empty test > note empty preimage events 1`] = `
4+
[
5+
{
6+
"data": {
7+
"hash_": "(hash)",
8+
},
9+
"method": "Noted",
10+
"section": "preimage",
11+
},
12+
]
13+
`;
14+
15+
exports[`Kusama Asset Hub PreImage > Kusama Asset Hub PreImage > preimage tests > preimage empty test > unnote empty preimage events 1`] = `
16+
[
17+
{
18+
"data": {
19+
"hash_": "(hash)",
20+
},
21+
"method": "Cleared",
22+
"section": "preimage",
23+
},
24+
]
25+
`;
26+
27+
exports[`Kusama Asset Hub PreImage > Kusama Asset Hub PreImage > preimage tests > preimage ensure updated test (fees due) > ensure updated preimage events 1`] = `[]`;
28+
29+
exports[`Kusama Asset Hub PreImage > Kusama Asset Hub PreImage > preimage tests > preimage ensure updated test (no fees due) > ensure updated preimage events 1`] = `[]`;
30+
331
exports[`Kusama Asset Hub PreImage > Kusama Asset Hub PreImage > preimage tests > preimage single note and unnote test > note preimage events 1`] = `
432
[
533
{
@@ -23,3 +51,47 @@ exports[`Kusama Asset Hub PreImage > Kusama Asset Hub PreImage > preimage tests
2351
},
2452
]
2553
`;
54+
55+
exports[`Kusama Asset Hub PreImage > failure tests > preimage oversized test > note oversized preimage events 1`] = `
56+
[
57+
{
58+
"data": {
59+
"hash_": "(hash)",
60+
},
61+
"method": "Noted",
62+
"section": "preimage",
63+
},
64+
]
65+
`;
66+
67+
exports[`Kusama Asset Hub PreImage > failure tests > preimage repeated note and unnote test > note preimage events 1`] = `
68+
[
69+
{
70+
"data": {
71+
"hash_": "(hash)",
72+
},
73+
"method": "Noted",
74+
"section": "preimage",
75+
},
76+
]
77+
`;
78+
79+
exports[`Kusama Asset Hub PreImage > failure tests > preimage repeated note and unnote test > repeat note preimage events 1`] = `[]`;
80+
81+
exports[`Kusama Asset Hub PreImage > failure tests > preimage repeated note and unnote test > repeat unnote preimage events 1`] = `[]`;
82+
83+
exports[`Kusama Asset Hub PreImage > failure tests > preimage repeated note and unnote test > unnote preimage events 1`] = `
84+
[
85+
{
86+
"data": {
87+
"hash_": "(hash)",
88+
},
89+
"method": "Cleared",
90+
"section": "preimage",
91+
},
92+
]
93+
`;
94+
95+
exports[`Kusama Asset Hub PreImage > failure tests > preimage single request and unrequest test as non-root > request preimage events 1`] = `[]`;
96+
97+
exports[`Kusama Asset Hub PreImage > failure tests > preimage single request and unrequest test as non-root > unrequest preimage events 1`] = `[]`;

packages/polkadot/src/__snapshots__/assetHubPolkadot.preimage.e2e.test.ts.snap

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,33 @@
11
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
22

3+
exports[`Polkadot Asset Hub PreImage > Polkadot Asset Hub PreImage > preimage tests > preimage empty test > note empty preimage events 1`] = `
4+
[
5+
{
6+
"data": {
7+
"hash_": "(hash)",
8+
},
9+
"method": "Noted",
10+
"section": "preimage",
11+
},
12+
]
13+
`;
14+
15+
exports[`Polkadot Asset Hub PreImage > Polkadot Asset Hub PreImage > preimage tests > preimage empty test > unnote empty preimage events 1`] = `
16+
[
17+
{
18+
"data": {
19+
"hash_": "(hash)",
20+
},
21+
"method": "Cleared",
22+
"section": "preimage",
23+
},
24+
]
25+
`;
26+
27+
exports[`Polkadot Asset Hub PreImage > Polkadot Asset Hub PreImage > preimage tests > preimage ensure updated test (fees due) > ensure updated preimage events 1`] = `[]`;
28+
29+
exports[`Polkadot Asset Hub PreImage > Polkadot Asset Hub PreImage > preimage tests > preimage ensure updated test (no fees due) > ensure updated preimage events 1`] = `[]`;
30+
331
exports[`Polkadot Asset Hub PreImage > Polkadot Asset Hub PreImage > preimage tests > preimage single note and unnote test > note preimage events 1`] = `
432
[
533
{
@@ -23,3 +51,47 @@ exports[`Polkadot Asset Hub PreImage > Polkadot Asset Hub PreImage > preimage te
2351
},
2452
]
2553
`;
54+
55+
exports[`Polkadot Asset Hub PreImage > failure tests > preimage oversized test > note oversized preimage events 1`] = `
56+
[
57+
{
58+
"data": {
59+
"hash_": "(hash)",
60+
},
61+
"method": "Noted",
62+
"section": "preimage",
63+
},
64+
]
65+
`;
66+
67+
exports[`Polkadot Asset Hub PreImage > failure tests > preimage repeated note and unnote test > note preimage events 1`] = `
68+
[
69+
{
70+
"data": {
71+
"hash_": "(hash)",
72+
},
73+
"method": "Noted",
74+
"section": "preimage",
75+
},
76+
]
77+
`;
78+
79+
exports[`Polkadot Asset Hub PreImage > failure tests > preimage repeated note and unnote test > repeat note preimage events 1`] = `[]`;
80+
81+
exports[`Polkadot Asset Hub PreImage > failure tests > preimage repeated note and unnote test > repeat unnote preimage events 1`] = `[]`;
82+
83+
exports[`Polkadot Asset Hub PreImage > failure tests > preimage repeated note and unnote test > unnote preimage events 1`] = `
84+
[
85+
{
86+
"data": {
87+
"hash_": "(hash)",
88+
},
89+
"method": "Cleared",
90+
"section": "preimage",
91+
},
92+
]
93+
`;
94+
95+
exports[`Polkadot Asset Hub PreImage > failure tests > preimage single request and unrequest test as non-root > request preimage events 1`] = `[]`;
96+
97+
exports[`Polkadot Asset Hub PreImage > failure tests > preimage single request and unrequest test as non-root > unrequest preimage events 1`] = `[]`;
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2+
3+
exports[`Polkadot PreImage > Polkadot PreImage > preimage tests > preimage empty test > note empty preimage events 1`] = `
4+
[
5+
{
6+
"data": {
7+
"hash_": "(hash)",
8+
},
9+
"method": "Noted",
10+
"section": "preimage",
11+
},
12+
]
13+
`;
14+
15+
exports[`Polkadot PreImage > Polkadot PreImage > preimage tests > preimage empty test > unnote empty preimage events 1`] = `
16+
[
17+
{
18+
"data": {
19+
"hash_": "(hash)",
20+
},
21+
"method": "Cleared",
22+
"section": "preimage",
23+
},
24+
]
25+
`;
26+
27+
exports[`Polkadot PreImage > Polkadot PreImage > preimage tests > preimage ensure updated test (fees due) > ensure updated preimage events 1`] = `[]`;
28+
29+
exports[`Polkadot PreImage > Polkadot PreImage > preimage tests > preimage ensure updated test (no fees due) > ensure updated preimage events 1`] = `[]`;
30+
31+
exports[`Polkadot PreImage > Polkadot PreImage > preimage tests > preimage single note and unnote test > note preimage events 1`] = `
32+
[
33+
{
34+
"data": {
35+
"hash_": "(hash)",
36+
},
37+
"method": "Noted",
38+
"section": "preimage",
39+
},
40+
]
41+
`;
42+
43+
exports[`Polkadot PreImage > Polkadot PreImage > preimage tests > preimage single note and unnote test > unnote preimage events 1`] = `
44+
[
45+
{
46+
"data": {
47+
"hash_": "(hash)",
48+
},
49+
"method": "Cleared",
50+
"section": "preimage",
51+
},
52+
]
53+
`;
54+
55+
exports[`Polkadot PreImage > failure tests > preimage oversized test > note oversized preimage events 1`] = `
56+
[
57+
{
58+
"data": {
59+
"hash_": "(hash)",
60+
},
61+
"method": "Noted",
62+
"section": "preimage",
63+
},
64+
]
65+
`;
66+
67+
exports[`Polkadot PreImage > failure tests > preimage repeated note and unnote test > note preimage events 1`] = `
68+
[
69+
{
70+
"data": {
71+
"hash_": "(hash)",
72+
},
73+
"method": "Noted",
74+
"section": "preimage",
75+
},
76+
]
77+
`;
78+
79+
exports[`Polkadot PreImage > failure tests > preimage repeated note and unnote test > repeat note preimage events 1`] = `[]`;
80+
81+
exports[`Polkadot PreImage > failure tests > preimage repeated note and unnote test > repeat unnote preimage events 1`] = `[]`;
82+
83+
exports[`Polkadot PreImage > failure tests > preimage repeated note and unnote test > unnote preimage events 1`] = `
84+
[
85+
{
86+
"data": {
87+
"hash_": "(hash)",
88+
},
89+
"method": "Cleared",
90+
"section": "preimage",
91+
},
92+
]
93+
`;
94+
95+
exports[`Polkadot PreImage > failure tests > preimage single request and unrequest test as non-root > request preimage events 1`] = `[]`;
96+
97+
exports[`Polkadot PreImage > failure tests > preimage single request and unrequest test as non-root > unrequest preimage events 1`] = `[]`;

0 commit comments

Comments
 (0)