|
|
|
@ -135,6 +135,38 @@ describe('timeSrv', () => { |
|
|
|
|
expect(time.to.valueOf()).toEqual(1410337665699); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
it('should handle epochs that look like formatted date without time', () => { |
|
|
|
|
location = { |
|
|
|
|
search: jest.fn(() => ({ |
|
|
|
|
from: '20149999', |
|
|
|
|
to: '20159999', |
|
|
|
|
})), |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
timeSrv = new TimeSrv(rootScope as any, jest.fn() as any, location as any, timer, new ContextSrvStub() as any); |
|
|
|
|
|
|
|
|
|
timeSrv.init(_dashboard); |
|
|
|
|
const time = timeSrv.timeRange(); |
|
|
|
|
expect(time.from.valueOf()).toEqual(20149999); |
|
|
|
|
expect(time.to.valueOf()).toEqual(20159999); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
it('should handle epochs that look like formatted date', () => { |
|
|
|
|
location = { |
|
|
|
|
search: jest.fn(() => ({ |
|
|
|
|
from: '201499991234567', |
|
|
|
|
to: '201599991234567', |
|
|
|
|
})), |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
timeSrv = new TimeSrv(rootScope as any, jest.fn() as any, location as any, timer, new ContextSrvStub() as any); |
|
|
|
|
|
|
|
|
|
timeSrv.init(_dashboard); |
|
|
|
|
const time = timeSrv.timeRange(); |
|
|
|
|
expect(time.from.valueOf()).toEqual(201499991234567); |
|
|
|
|
expect(time.to.valueOf()).toEqual(201599991234567); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
it('should handle bad dates', () => { |
|
|
|
|
location = { |
|
|
|
|
search: jest.fn(() => ({ |
|
|
|
|