Skip to content

Commit

Permalink
restore accidentally removed stubs, timers, initializations
Browse files Browse the repository at this point in the history
Several of the timer stubs created a reference to a clock variable, but never used that variable, so they were causing no-unused-vars errors. In the process of fixing those errors, some of those must have been removed, which caused some test failures.
  • Loading branch information
spalger committed Aug 31, 2016
1 parent ebfcca0 commit 4b43cdc
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 15 deletions.
4 changes: 4 additions & 0 deletions src/ui/public/directives/__tests__/timepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import moment from 'moment';
import expect from 'expect.js';
import _ from 'lodash';
import ngMock from 'ng_mock';
import sinon from 'auto-release-sinon';
import 'plugins/kibana/visualize/index';
import 'plugins/kibana/dashboard/index';
import 'plugins/kibana/discover/index';
Expand Down Expand Up @@ -64,6 +65,9 @@ const init = function () {


describe('timepicker directive', function () {
beforeEach(() => {
sinon.useFakeTimers(moment('2014-01-01T04:04:04.444Z').valueOf());
});

describe('tabs', function () {

Expand Down
24 changes: 12 additions & 12 deletions src/ui/public/doc_viewer/__tests__/doc_viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ describe('docViewer', function () {
let init;

beforeEach(function () {
ngMock.module('kibana', function (PrivateProvider) {
stubRegistry = new Registry({
index: ['name'],
order: ['order'],
constructor() {
this.forEach(docView => {
docView.shouldShow = docView.shouldShow || _.constant(true);
docView.name = docView.name || docView.title;
});
}
});
stubRegistry = new Registry({
index: ['name'],
order: ['order'],
constructor() {
this.forEach(docView => {
docView.shouldShow = docView.shouldShow || _.constant(true);
docView.name = docView.name || docView.title;
});
}
});

ngMock.module('kibana', function (PrivateProvider) {
PrivateProvider.swap(docViewsRegistry, stubRegistry);
});
});
Expand All @@ -39,7 +39,6 @@ describe('docViewer', function () {
return $elem;
});
};

});

describe('injecting views', function () {
Expand All @@ -55,6 +54,7 @@ describe('docViewer', function () {
});
});
}

it('should have a tab for the view', function () {
registerExtension();
registerExtension({ title: 'exampleView2' });
Expand Down
8 changes: 5 additions & 3 deletions src/ui/public/filters/__tests__/moment.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import expect from 'expect.js';
import moment from 'moment';
import ngMock from 'ng_mock';
import sinon from 'auto-release-sinon';
import 'ui/filters/moment';

let filter;
Expand All @@ -9,6 +10,8 @@ const init = function () {
// Load the application
ngMock.module('kibana');

sinon.useFakeTimers(moment('2014-01-01T04:04:04.444').valueOf());

// Create the scope
ngMock.inject(function ($filter) {
filter = $filter('moment');
Expand All @@ -17,7 +20,6 @@ const init = function () {


describe('moment formatting filter', function () {

beforeEach(function () {
init();
});
Expand All @@ -28,11 +30,11 @@ describe('moment formatting filter', function () {

// MMMM Do YYYY, HH:mm:ss.SSS
it('should format moments', function () {
expect(filter(moment())).to.be('January 1st 2014, 06:06:06.666');
expect(filter(moment())).to.be('January 1st 2014, 04:04:04.444');
});

it('should format dates', function () {
expect(filter(new Date())).to.be('January 1st 2014, 06:06:06.666');
expect(filter(new Date())).to.be('January 1st 2014, 04:04:04.444');
});

it('should return the original value if passed anything other than a moment or Date', function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ describe('TileMap Map Tests', function () {

beforeEach(function () {
createStub = sinon.stub(TileMapMap.prototype, '_createMap', _.noop);
new TileMapMap($mockMapEl, geoJsonData, {});
});

it('should create the map', function () {
Expand Down Expand Up @@ -113,6 +114,7 @@ describe('TileMap Map Tests', function () {
this.map = leafletMocks.map;
this._attachEvents();
});
new TileMapMap($mockMapEl, geoJsonData, {});
});

it('should attach interaction events', function () {
Expand Down

0 comments on commit 4b43cdc

Please sign in to comment.