From 8dea2aaf8c8e30d2dec0e0542fc76f77b2918aec Mon Sep 17 00:00:00 2001
From: Frank Bell <frank@parity.io>
Date: Fri, 28 Oct 2022 17:24:15 +0100
Subject: [PATCH] test: add test for multiple events of same type

---
 tests/0_multiple-events-of-type.yml | 86 +++++++++++++++++++++++++++++
 tests/config.toml                   | 45 +++++++++++++++
 2 files changed, 131 insertions(+)
 create mode 100644 tests/0_multiple-events-of-type.yml
 create mode 100644 tests/config.toml

diff --git a/tests/0_multiple-events-of-type.yml b/tests/0_multiple-events-of-type.yml
new file mode 100644
index 0000000..889c393
--- /dev/null
+++ b/tests/0_multiple-events-of-type.yml
@@ -0,0 +1,86 @@
+---
+settings:
+  chains:
+    relay_chain: &relay_chain
+      wsPort: 9900
+    reserve_parachain:
+      wsPort: 9910
+      paraId: &reserve_parachain_id 1000
+  variables:
+    common:
+      amount_to_send: &amount_to_send 1000000000000000
+    chains:
+      relay_chain:
+        alice_signer: &relay_chain_signer //Alice
+        alice_account: &relay_chain_account 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
+      reserve_parachain:
+        bob_account: &reserve_parachain_account '0x8eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a48'
+
+tests:
+  - name: Tests
+    describes:
+      - name: Multiple events of same type
+        its:
+          - name: Tests should support multiple events of the same type
+            actions:
+              - extrinsics:
+                  - chain: *relay_chain
+                    signer: *relay_chain_signer
+                    pallet: xcmPallet
+                    call: limitedTeleportAssets
+                    args: [
+                      { # destination
+                        v1: {
+                          parents: 0,
+                          interior: {
+                            x1: {
+                              Parachain: *reserve_parachain_id
+                            }
+                          }
+                        }
+                      },
+                      { # beneficiary
+                        v1: {
+                          parents: 0,
+                          interior: {
+                            x1: {
+                              AccountId32: {
+                                network: Any,
+                                id: *reserve_parachain_account
+                              }
+                            }
+                          }
+                        }
+                      },
+                      { # assets
+                        v1: [
+                          {
+                            id: {
+                              Concrete: {
+                                parents: 0,
+                                interior: Here
+                              }
+                            },
+                            fun: {
+                              Fungible: *amount_to_send
+                            }
+                          }
+                        ]
+                      },
+                      0, # feeAssetItem
+                      Unlimited # weightLimit
+                    ]
+                    events:
+                      - name: balances.Withdraw
+                        attributes:
+                          - type: AccountId32
+                            value: *relay_chain_account
+                          - type: u128
+                            value: *amount_to_send
+                      - name: balances.Withdraw
+                        attributes:
+                          - type: AccountId32
+                            value: *relay_chain_account
+                          - type: u128
+                            threshold: [10, 10]
+                            value: 148,804,953
\ No newline at end of file
diff --git a/tests/config.toml b/tests/config.toml
new file mode 100644
index 0000000..98adbae
--- /dev/null
+++ b/tests/config.toml
@@ -0,0 +1,45 @@
+[settings]
+timeout = 1000
+
+[relaychain]
+chain = "rococo-local"
+default_command = "./bin/polkadot"
+
+  [[relaychain.nodes]]
+  name = "alice"
+  validator = true
+  ws_port = 9900
+  extra_args = [ "-lparachain=debug" ]
+
+  [[relaychain.nodes]]
+  name = "bob"
+  validator = true
+  extra_args = [ "-lparachain=debug" ]
+
+  [[relaychain.nodes]]
+  name = "charlie"
+  validator = true
+  extra_args = [ "-lparachain=debug" ]
+
+[[parachains]]
+id = 1000
+add_to_genesis = true
+cumulus_based = true
+chain = "statemine-local"
+
+  [[parachains.collators]]
+  name = "statemine-collator01"
+  command = "./bin/polkadot-parachain"
+  ws_port = 9910
+  args = ["--log=xcm=trace,pallet-assets=trace"]
+
+  [[parachains.collators]]
+  name = "statemine-collator02"
+  command = "./bin/polkadot-parachain"
+  ws_port = 9911
+  args = ["--log=xcm=trace,pallet-assets=trace"]
+
+[types.Header]
+number = "u64"
+parent_hash = "Hash"
+post_state = "Hash"
\ No newline at end of file