fix: add missing getSlot API

This commit is contained in:
Michael Vines
2019-08-02 16:06:54 -07:00
parent 60ac6fc5b7
commit 2eeaf668fa
3 changed files with 45 additions and 0 deletions

View File

@ -128,6 +128,31 @@ test('get balance', async () => {
expect(balance).toBeGreaterThanOrEqual(0);
});
test('get slot', async () => {
const connection = new Connection(url);
mockRpc.push([
url,
{
method: 'getSlot',
},
{
error: null,
result: 123,
},
]);
const slotLeader = await connection.getSlot();
if (mockRpcEnabled) {
expect(slotLeader).toBe(123);
} else {
// No idea what the correct slot value should be on a live cluster, so
// just check the type
expect(typeof slotLeader).toBe('number');
}
});
test('get slot leader', async () => {
const connection = new Connection(url);