});
});
});
+
+describe('hasHistoryData', () => {
+ it('should correctly detect if there is history data', () => {
+ expect(
+ utils.hasHistoryData([
+ {
+ name: 'foo',
+ type: 'INT',
+ data: [
+ { x: new Date('2017-04-27T08:21:32+0200'), y: 2 },
+ { x: new Date('2017-04-30T23:06:24+0200'), y: 2 }
+ ]
+ }
+ ])
+ ).toBeTruthy();
+ expect(
+ utils.hasHistoryData([
+ {
+ name: 'foo',
+ type: 'INT',
+ data: []
+ },
+ {
+ name: 'bar',
+ type: 'INT',
+ data: [
+ { x: new Date('2017-04-27T08:21:32+0200'), y: 2 },
+ { x: new Date('2017-04-30T23:06:24+0200'), y: 2 }
+ ]
+ }
+ ])
+ ).toBeTruthy();
+ expect(
+ utils.hasHistoryData([
+ {
+ name: 'bar',
+ type: 'INT',
+ data: [{ x: new Date('2017-04-27T08:21:32+0200'), y: 2 }]
+ }
+ ])
+ ).toBeFalsy();
+ });
+});
export const hasDataValues = (serie: Serie) => serie.data.some(point => point.y || point.y === 0);
export const hasHistoryData = (series: Array<Serie>) =>
- series.some(serie => serie.data && serie.data.length > 2);
+ series.some(serie => serie.data && serie.data.length > 1);
export const historyQueryChanged = (prevQuery: Query, nextQuery: Query): boolean =>
prevQuery.graph !== nextQuery.graph;