feat: add getBlockTime method

This commit is contained in:
Justin Starry
2020-05-19 11:27:36 +08:00
committed by Michael Vines
parent e10a5c90ab
commit 4b613a4574
4 changed files with 50 additions and 0 deletions

View File

@ -1039,6 +1039,29 @@ test('get recent blockhash', async () => {
expect(feeCalculator.lamportsPerSignature).toBeGreaterThanOrEqual(0);
});
test('get block time', async () => {
const connection = new Connection(url);
mockRpc.push([
url,
{
method: 'getBlockTime',
params: [1],
},
{
error: null,
result: 10000,
},
]);
const blockTime = await connection.getBlockTime(1);
if (blockTime === null) {
expect(blockTime).not.toBeNull();
} else {
expect(blockTime).toBeGreaterThan(0);
}
});
test('getVersion', async () => {
const connection = new Connection(url);