mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Fix linting and make sure tests pass UTC moment objects
This commit is contained in:
parent
d9314c29e9
commit
d966e30214
2 changed files with 12 additions and 12 deletions
|
@ -5,7 +5,7 @@ define(function (require) {
|
|||
throw new Error('Start must begin before end.');
|
||||
}
|
||||
|
||||
if (!~['hour','day','week','year'].indexOf(interval)) {
|
||||
if (!~['hour', 'day', 'week', 'year'].indexOf(interval)) {
|
||||
throw new Error('Interval must be hour, day, week, or year.');
|
||||
}
|
||||
|
||||
|
@ -13,8 +13,8 @@ define(function (require) {
|
|||
throw new Error('Pattern can not be empty.');
|
||||
}
|
||||
|
||||
var data = [];
|
||||
while(start.isBefore(end)) {
|
||||
var data = [];
|
||||
while (start.isBefore(end)) {
|
||||
start.add(interval, '1');
|
||||
data.push(start.format(pattern));
|
||||
}
|
||||
|
|
|
@ -15,12 +15,12 @@ define(function (require) {
|
|||
expect(function () { calculateIndices(moment().subtract('day', 1), moment(), 'hour' ); }).to.throwError();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe('hourly interval', function() {
|
||||
beforeEach(function () {
|
||||
var date = '2014-01-15 04:30:10';
|
||||
this.start = moment(date).subtract('hours', 4);
|
||||
this.end = moment(date);
|
||||
this.start = moment.utc(date).subtract('hours', 4);
|
||||
this.end = moment.utc(date);
|
||||
this.interval = 'hour';
|
||||
this.pattern = '[logstash-]YYYY.MM.DD.HH';
|
||||
this.fixture = [
|
||||
|
@ -39,8 +39,8 @@ define(function (require) {
|
|||
describe('daily interval', function() {
|
||||
beforeEach(function () {
|
||||
var date = '2014-01-15 04:30:10';
|
||||
this.start = moment(date).subtract('days', 4);
|
||||
this.end = moment(date);
|
||||
this.start = moment.utc(date).subtract('days', 4);
|
||||
this.end = moment.utc(date);
|
||||
this.interval = 'day';
|
||||
this.pattern = '[logstash-]YYYY.MM.DD';
|
||||
this.fixture = [
|
||||
|
@ -59,8 +59,8 @@ define(function (require) {
|
|||
describe('weekly interval', function() {
|
||||
beforeEach(function () {
|
||||
var date = '2014-01-15 04:30:10';
|
||||
this.start = moment(date).subtract('week', 4);
|
||||
this.end = moment(date);
|
||||
this.start = moment.utc(date).subtract('week', 4);
|
||||
this.end = moment.utc(date);
|
||||
this.interval = 'week';
|
||||
this.pattern = '[logstash-]YYYY.MM.DD';
|
||||
this.fixture = [
|
||||
|
@ -79,8 +79,8 @@ define(function (require) {
|
|||
describe('yearly interval', function() {
|
||||
beforeEach(function () {
|
||||
var date = '2014-01-15 04:30:10';
|
||||
this.start = moment(date).subtract('years', 4);
|
||||
this.end = moment(date);
|
||||
this.start = moment.utc(date).subtract('years', 4);
|
||||
this.end = moment.utc(date);
|
||||
this.interval = 'year';
|
||||
this.pattern = '[logstash-]YYYY.MM.DD';
|
||||
this.fixture = [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue