Skip to content
This repository was archived by the owner on Feb 23, 2021. It is now read-only.

Commit 810f288

Browse files
authored
Merge pull request #686 from erkarl/display-block-height-notification
Display blocks height in notification bar while syncing
2 parents 7e903a8 + 7e106ba commit 810f288

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

src/action/info.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ class InfoAction {
3232
this.startingSyncTimestamp = response.best_header_timestamp || 0;
3333
}
3434
if (!response.synced_to_chain) {
35-
this._notification.display({ msg: 'Syncing to chain', wait: true });
35+
this._notification.display({
36+
msg: `Syncing to chain (block: ${response.block_height})`,
37+
wait: true,
38+
});
3639
log.info(`Syncing to chain ... block height: ${response.block_height}`);
3740
this._store.percentSynced = this.calcPercentSynced(response);
3841
}

test/unit/action/info.spec.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,28 @@ describe('Action Info Unit Tests', () => {
4242
expect(store.blockHeight, 'to equal', 'some-height');
4343
});
4444

45+
it('should show notification if syncing', async () => {
46+
grpc.sendCommand.withArgs('getInfo').resolves({
47+
synced_to_chain: false,
48+
block_height: 1234,
49+
});
50+
await info.getInfo();
51+
expect(notification.display, 'was called once');
52+
expect(notification.display, 'was called with', {
53+
msg: 'Syncing to chain (block: 1234)',
54+
wait: true,
55+
});
56+
});
57+
58+
it('should not show notification if synced', async () => {
59+
grpc.sendCommand.withArgs('getInfo').resolves({
60+
synced_to_chain: true,
61+
block_height: 1234,
62+
});
63+
await info.getInfo();
64+
expect(notification.display, 'was not called');
65+
});
66+
4567
it('should return true if chain is synced', async () => {
4668
grpc.sendCommand.withArgs('getInfo').resolves({
4769
synced_to_chain: true,

0 commit comments

Comments
 (0)