Skip to content

Commit 7f4518f

Browse files
committed
Remove mistakenly added setup function
Meant for a different branch
1 parent bd23012 commit 7f4518f

1 file changed

Lines changed: 0 additions & 58 deletions

File tree

packages/shared/src/setup.ts

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { type Chain, captureSnapshot, createNetworks } from '@e2e-test/networks'
2-
import { polkadot } from '@e2e-test/networks/chains'
32

43
import { afterAll, beforeEach, expect } from 'vitest'
54

@@ -52,60 +51,3 @@ export async function setupBalances(client: any, accounts: { address: any; amoun
5251
expect(account.data.reserved.toNumber(), `User ${address} reserved balance should be 0`).toBe(0)
5352
}
5453
}
55-
56-
/**
57-
* Sets up blockchain networks for testing with automatic snapshot restore and cleanup.
58-
*
59-
* This function creates test networks for the specified chain types and sets up test fixtures
60-
* to automatically restore snapshots between tests and clean up when finished.
61-
*
62-
* @param chains - Array of Chain type parameters defining which networks to create
63-
* @returns Promise resolving to array of created network instances
64-
*
65-
* @example
66-
* const [assetHubPolkadotClient, acalaClient] = await setupNetworks(assetHubPolkadot, acala)
67-
*/
68-
export async function setupNetworksForAssetHub<T extends Chain[]>(...chains: T) {
69-
const networks = await createNetworks(...chains, polkadot)
70-
71-
const restoreSnapshot = captureSnapshot(...networks)
72-
73-
beforeEach(async () => {
74-
await restoreSnapshot()
75-
await Promise.all(
76-
networks.map(async (network) => {
77-
const blockNumber = (await network.api.rpc.chain.getHeader()).number.toNumber()
78-
79-
network.dev.setHead(blockNumber)
80-
}),
81-
)
82-
})
83-
84-
afterAll(async () => {
85-
await Promise.all(networks.map((network) => network.teardown()))
86-
})
87-
88-
const [assetHubPolkadotClient, polkadotClient] = networks
89-
const number = (await polkadotClient.api.rpc.chain.getHeader()).number.toNumber()
90-
91-
// 1. First, accelerate the end of the cool-off period
92-
polkadotClient.dev.setStorage({
93-
RcMigrator: {
94-
RcMigrationStage: { CoolOff: { end_at: number + 1 } },
95-
},
96-
})
97-
98-
// 2. Next, create a new block to end it
99-
await polkadotClient.dev.newBlock()
100-
101-
const stage = await polkadotClient.api.query.rcMigrator.rcMigrationStage()
102-
expect(stage.toJSON()).toBe({ SignalMigrationFinish: null })
103-
104-
// 3. Create a new block in AH to intake data and finish migrating there
105-
await assetHubPolkadotClient.dev.newBlock()
106-
107-
// 4. Create a new block in RC to move to `MigrationDone`
108-
await polkadotClient.dev.newBlock()
109-
110-
return [assetHubPolkadotClient]
111-
}

0 commit comments

Comments
 (0)