mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
heatmap tests: fix timezone-dependent test error
This commit is contained in:
parent
7c5b9f8c5b
commit
65a829b64d
@ -74,11 +74,11 @@ describe('grafanaHeatmap', function () {
|
|||||||
renderingCompleted: sinon.spy(),
|
renderingCompleted: sinon.spy(),
|
||||||
hiddenSeries: {},
|
hiddenSeries: {},
|
||||||
dashboard: {
|
dashboard: {
|
||||||
getTimezone: sinon.stub().returns('browser')
|
getTimezone: sinon.stub().returns('utc')
|
||||||
},
|
},
|
||||||
range: {
|
range: {
|
||||||
from: moment(1422774000000),
|
from: moment.utc("01 Mar 2017 10:00:00"),
|
||||||
to: moment(1422774100000),
|
to: moment.utc("01 Mar 2017 11:00:00"),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -148,7 +148,14 @@ describe('grafanaHeatmap', function () {
|
|||||||
|
|
||||||
it('should draw correct X axis', function () {
|
it('should draw correct X axis', function () {
|
||||||
var xTicks = getTicks(ctx.element, ".axis-x");
|
var xTicks = getTicks(ctx.element, ".axis-x");
|
||||||
expect(xTicks).to.eql(['10:00:00', '10:00:15', '10:00:30', '10:00:45', '10:01:00', '10:01:15', '10:01:30']);
|
let expectedTicks = [
|
||||||
|
formatLocalTime("01 Mar 2017 10:00:00"),
|
||||||
|
formatLocalTime("01 Mar 2017 10:15:00"),
|
||||||
|
formatLocalTime("01 Mar 2017 10:30:00"),
|
||||||
|
formatLocalTime("01 Mar 2017 10:45:00"),
|
||||||
|
formatLocalTime("01 Mar 2017 11:00:00")
|
||||||
|
];
|
||||||
|
expect(xTicks).to.eql(expectedTicks);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -249,3 +256,8 @@ function getTicks(element, axisSelector) {
|
|||||||
return this.textContent;
|
return this.textContent;
|
||||||
}).get();
|
}).get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function formatLocalTime(timeStr) {
|
||||||
|
let format = "HH:mm";
|
||||||
|
return moment.utc(timeStr).local().format(format);
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user