add test for persisting global state

This commit is contained in:
Joe Fleming 2014-08-27 14:39:27 -07:00
parent a9167bbd0c
commit d431b278d0

View file

@ -90,6 +90,22 @@ define(function (require) {
expect(kbnUrl.reload.callCount).to.be(uniqWordCount);
});
it('should persist global state', function () {
var wordCount = _.random(3, 6);
var globalStateSpy = sinon.spy(globalStateMock, 'writeToUrl');
var urls = faker.Lorem.words(wordCount).map(function (url) {
return '/' + url;
});
urls.forEach(function (url) {
kbnUrl.change(url);
expect($location.url()).to.be(url);
});
expect(globalStateSpy.callCount).to.be(wordCount);
});
it('should reload when forceReload is true', function () {
var words = [faker.Lorem.words(_.random(2, 6)).join('/')];
words.push(words[0]);