This repository has been archived by the owner on Jun 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 457
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #440 from MaciejBaj/290-genesis-loading-progress
Add genesis block loading progress logger - Closes #290
- Loading branch information
Showing
5 changed files
with
164 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
'use strict'; | ||
|
||
var chai = require('chai'); | ||
var express = require('express'); | ||
var sinon = require('sinon'); | ||
var node = require('../../node.js'); | ||
|
||
var modulesLoader = require('../../common/initModule').modulesLoader; | ||
var Blocks = require('../../../modules/blocks'); | ||
|
||
describe('blocks', function () { | ||
|
||
var blocks; | ||
|
||
before(function (done) { | ||
modulesLoader.initModuleWithDb(Blocks, function (err, __blocks) { | ||
if (err) { | ||
return done(err); | ||
} | ||
blocks = __blocks; | ||
done(); | ||
}); | ||
}); | ||
|
||
describe('getBlockProgressLogger', function () { | ||
|
||
it('should logs correctly', function () { | ||
var tracker = blocks.getBlockProgressLogger(5, 2, ''); | ||
tracker.log = sinon.spy(); | ||
node.expect(tracker.applied).to.equals(0); | ||
node.expect(tracker.step).to.equals(2); | ||
tracker.applyNext(); | ||
node.expect(tracker.log.calledOnce).to.ok; | ||
node.expect(tracker.applied).to.equals(1); | ||
tracker.applyNext(); | ||
node.expect(tracker.log.calledTwice).to.not.ok; | ||
node.expect(tracker.applied).to.equals(2); | ||
tracker.applyNext(); | ||
node.expect(tracker.log.calledTwice).to.ok; | ||
node.expect(tracker.applied).to.equals(3); | ||
tracker.applyNext(); | ||
node.expect(tracker.log.calledThrice).to.not.ok; | ||
node.expect(tracker.applied).to.equals(4); | ||
tracker.applyNext(); | ||
node.expect(tracker.log.calledThrice).to.ok; | ||
node.expect(tracker.applied).to.equals(5); | ||
|
||
node.expect(tracker.applyNext.bind(tracker)).to.throw('Cannot apply transaction over the limit: 5'); | ||
}); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.