mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: update datasource test
This commit is contained in:
parent
22e547f625
commit
2cbbc39e18
@ -889,6 +889,24 @@ describe('applyTemplateVariables', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('getTimeRange*()', () => {
|
||||
it('exposes the current time range', () => {
|
||||
const ds = createLokiDatasource();
|
||||
const timeRange = ds.getTimeRange();
|
||||
|
||||
expect(timeRange.from).toBeDefined();
|
||||
expect(timeRange.to).toBeDefined();
|
||||
});
|
||||
|
||||
it('exposes time range as params', () => {
|
||||
const ds = createLokiDatasource();
|
||||
const params = ds.getTimeRangeParams();
|
||||
|
||||
// Returns a very big integer, so we stringify it for the assertion
|
||||
expect(JSON.stringify(params)).toEqual('{"start":1524650400000000000,"end":1524654000000000000}');
|
||||
});
|
||||
});
|
||||
|
||||
describe('Variable support', () => {
|
||||
it('has Loki variable support', () => {
|
||||
const ds = createLokiDatasource(templateSrvStub);
|
||||
|
@ -18,7 +18,7 @@ const rawRange = {
|
||||
};
|
||||
|
||||
const defaultTimeSrvMock = {
|
||||
timeRange: () => ({
|
||||
timeRange: jest.fn().mockReturnValue({
|
||||
from: rawRange.from,
|
||||
to: rawRange.to,
|
||||
raw: rawRange,
|
||||
|
Loading…
Reference in New Issue
Block a user