Skip to content

Commit 38edd7a

Browse files
committed
Add another test
1 parent 166308c commit 38edd7a

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

app/scripts/migrations/126.test.ts

+42
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,48 @@ describe('migration #126', () => {
134134
});
135135
});
136136

137+
it('uses the network from network configurations if set', async () => {
138+
const oldStorage = getMockState(NETWORK_TYPES.SEPOLIA, {
139+
[NETWORK_TYPES.SEPOLIA]: {
140+
chainId: CHAIN_IDS.LINEA_SEPOLIA,
141+
},
142+
});
143+
144+
const newStorage = await migrate(oldStorage);
145+
expect(newStorage.data.PermissionController).toStrictEqual({
146+
subjects: {
147+
[MOCK_SNAP_ID]: {
148+
permissions: {
149+
[SnapEndowments.EthereumProvider]: {
150+
caveats: [],
151+
date: 1664187844588,
152+
id: 'izn0WGUO8cvq_jqvLQuQP',
153+
invoker: MOCK_ORIGIN,
154+
parentCapability: SnapEndowments.EthereumProvider,
155+
},
156+
[PermissionNames.permittedChains]: {
157+
caveats: [
158+
CaveatFactories[CaveatTypes.restrictNetworkSwitching](
159+
[CHAIN_IDS.LINEA_SEPOLIA],
160+
)
161+
],
162+
date: 1723635247705,
163+
id: expect.any(String),
164+
invoker: MOCK_SNAP_ID,
165+
parentCapability: PermissionNames.permittedChains,
166+
}
167+
},
168+
},
169+
}
170+
});
171+
172+
expect(newStorage.data.SelectedNetworkController).toStrictEqual({
173+
domains: {
174+
[MOCK_SNAP_ID]: NETWORK_TYPES.SEPOLIA
175+
}
176+
});
177+
});
178+
137179
// @ts-expect-error - Property `each` does not exist on type `TestFunction`.
138180
it.each([
139181
{},

0 commit comments

Comments
 (0)