feat: getEpochInfo rpc, yarn lint (#540)

This commit is contained in:
Sunny Gleason
2019-10-29 12:50:05 -04:00
committed by Michael Vines
parent 29aabcb195
commit 3f38e89886
2 changed files with 70 additions and 2 deletions

View File

@ -170,6 +170,34 @@ test('get inflation', async () => {
}
});
test('get epoch info', async () => {
const connection = new Connection(url);
mockRpc.push([
url,
{
method: 'getEpochInfo',
params: [],
},
{
error: null,
result: {
epoch: 1,
slotIndex: 1,
slotsInEpoch: 8192,
absoluteSlot: 1,
},
},
]);
const epochInfo = await connection.getEpochInfo();
for (const key of ['epoch', 'slotIndex', 'slotsInEpoch', 'absoluteSlot']) {
expect(epochInfo).toHaveProperty(key);
expect(epochInfo[key]).toBeGreaterThan(0);
}
});
test('get epoch schedule', async () => {
const connection = new Connection(url);