Skip to content
This repository was archived by the owner on Feb 23, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/action/info.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ class InfoAction {
this.startingSyncTimestamp = response.best_header_timestamp || 0;
}
if (!response.synced_to_chain) {
this._notification.display({ msg: 'Syncing to chain', wait: true });
this._notification.display({
msg: `Syncing to chain (block: ${response.block_height})`,
wait: true,
});
log.info(`Syncing to chain ... block height: ${response.block_height}`);
this._store.percentSynced = this.calcPercentSynced(response);
}
Expand Down
22 changes: 22 additions & 0 deletions test/unit/action/info.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,28 @@ describe('Action Info Unit Tests', () => {
expect(store.blockHeight, 'to equal', 'some-height');
});

it('should show notification if syncing', async () => {
grpc.sendCommand.withArgs('getInfo').resolves({
synced_to_chain: false,
block_height: 1234,
});
await info.getInfo();
expect(notification.display, 'was called once');
expect(notification.display, 'was called with', {
msg: 'Syncing to chain (block: 1234)',
wait: true,
});
});

it('should not show notification if synced', async () => {
grpc.sendCommand.withArgs('getInfo').resolves({
synced_to_chain: true,
block_height: 1234,
});
await info.getInfo();
expect(notification.display, 'was not called');
});

it('should return true if chain is synced', async () => {
grpc.sendCommand.withArgs('getInfo').resolves({
synced_to_chain: true,
Expand Down