Created
March 9, 2018 15:42
-
-
Save ihordiachenko/1a6232ce8b2808bd8c0a469b793e4496 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
describe('init', function() { | |
beforeEach(function() { | |
ctrl.statistics = undefined; | |
sinon.stub(ctrl.statisticsService, 'getRangeVerbose'); | |
sinon.stub(ctrl, 'initRangePicker'); | |
sinon.stub(ctrl, 'watchFilters'); | |
sinon.stub(ctrl, 'pick'); | |
sinon.stub(ctrl, 'getFilters'); | |
}); | |
describe('when custom date isn’t set', function() { | |
it('initiliazes and doesn’t call getRangeVerbose()', function() { | |
ctrl.getFilters.returns({isCustom: false}); | |
ctrl.init(); | |
expect(ctrl.statistics).to.be.not.empty; | |
expect(ctrl.statisticsService.getRangeVerbose).to.have | |
.not.been.called; | |
expect(ctrl.initRangePicker).to.have.been.called; | |
expect(ctrl.watchFilters).to.have.been.called; | |
expect(ctrl.pick).to.have.been.called; | |
}); | |
}); | |
describe('when custom date set', function() { | |
it('initiliazes and calls getRangeVerbose()', function() { | |
ctrl.getFilters.returns({isCustom: true}); | |
ctrl.init(); | |
expect(ctrl.statistics).to.be.not.empty; | |
expect(ctrl.statisticsService.getRangeVerbose).to.have.been | |
.called; | |
expect(ctrl.initRangePicker).to.have.been.called; | |
expect(ctrl.watchFilters).to.have.been.called; | |
expect(ctrl.pick).to.have.been.called; | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment