Skip to content

Commit 5528ba9

Browse files
Fix return value for network version mocking
1 parent be470b8 commit 5528ba9

File tree

3 files changed

+3
-10
lines changed

3 files changed

+3
-10
lines changed

packages/examples/packages/ethereum-provider/src/index.test.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,7 @@ describe('onRpcRequest', () => {
4545
const MOCK_VERSION = '1'; // Ethereum Mainnet
4646

4747
it('returns the current network version', async () => {
48-
const { request, mockJsonRpc } = await installSnap();
49-
50-
// To avoid relying on the network, we mock the response from the Ethereum
51-
// provider.
52-
mockJsonRpc({
53-
method: 'net_version',
54-
result: MOCK_VERSION,
55-
});
48+
const { request } = await installSnap();
5649

5750
const response = await request({
5851
method: 'getVersion',

packages/snaps-simulation/src/middleware/internal-methods/net-version.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ describe('getNetworkVersionHandler', () => {
2323
);
2424

2525
expect(end).toHaveBeenCalled();
26-
expect(result.result).toBe('0x01');
26+
expect(result.result).toBe('1');
2727
});
2828
});

packages/snaps-simulation/src/middleware/internal-methods/net-version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export async function getNetworkVersionHandler(
2828
) {
2929
// For now this will return a mocked result, this should probably match
3030
// whatever network the simulation is using.
31-
response.result = '0x01';
31+
response.result = '1';
3232

3333
return end();
3434
}

0 commit comments

Comments
 (0)