Skip to content

Commit

Permalink
Fix return value for network version mocking
Browse files Browse the repository at this point in the history
  • Loading branch information
FrederikBolding committed Jan 14, 2025
1 parent be470b8 commit 5528ba9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,7 @@ describe('onRpcRequest', () => {
const MOCK_VERSION = '1'; // Ethereum Mainnet

it('returns the current network version', async () => {
const { request, mockJsonRpc } = await installSnap();

// To avoid relying on the network, we mock the response from the Ethereum
// provider.
mockJsonRpc({
method: 'net_version',
result: MOCK_VERSION,
});
const { request } = await installSnap();

const response = await request({
method: 'getVersion',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ describe('getNetworkVersionHandler', () => {
);

expect(end).toHaveBeenCalled();
expect(result.result).toBe('0x01');
expect(result.result).toBe('1');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export async function getNetworkVersionHandler(
) {
// For now this will return a mocked result, this should probably match
// whatever network the simulation is using.
response.result = '0x01';
response.result = '1';

return end();
}

0 comments on commit 5528ba9

Please sign in to comment.