Skip to content

Commit

Permalink
[e2e] Add eth_gasPrice json rpc method test.
Browse files Browse the repository at this point in the history
  • Loading branch information
tmashuang committed Sep 22, 2023
1 parent ff6937a commit fc91d0c
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions test/e2e/json-rpc/eth_gasPrice.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
const { strict: assert } = require('assert');
const { withFixtures, defaultGanacheOptions } = require('../helpers');
const FixtureBuilder = require('../fixture-builder');

describe('eth_gasPrice', function () {
it('executes gas price json rpc call', async function () {
await withFixtures(
{
dapp: true,
fixtures: new FixtureBuilder()
.withPermissionControllerConnectedToTestDapp()
.build(),
ganacheOptions: defaultGanacheOptions,
title: this.test.title,
},
async ({ driver }) => {
await driver.navigate();
await driver.fill('#password', 'correct horse battery staple');
await driver.press('#password', driver.Key.ENTER);

// eth_gasPrice
await driver.openNewPage(`http://127.0.0.1:8080`);

const gasPriceRequest = JSON.stringify({
jsonrpc: '2.0',
method: 'eth_gasPrice',
});

const gasPrice = await driver.executeScript(
`return window.ethereum.request(${gasPriceRequest})`,
);

assert.strictEqual(gasPrice, '0x77359400'); // 2000000000
},
);
});
});

0 comments on commit fc91d0c

Please sign in to comment.