2017-06-20 08:50:31 +00:00
|
|
|
import MonitoringStore from '~/monitoring/stores/monitoring_store';
|
2018-07-17 20:44:26 +00:00
|
|
|
import MonitoringMock, { deploymentData, environmentData } from './mock_data';
|
2017-06-20 08:50:31 +00:00
|
|
|
|
2018-03-07 20:55:23 +00:00
|
|
|
describe('MonitoringStore', function () {
|
2017-06-20 08:50:31 +00:00
|
|
|
this.store = new MonitoringStore();
|
|
|
|
this.store.storeMetrics(MonitoringMock.data);
|
|
|
|
|
2017-09-06 07:42:47 +00:00
|
|
|
it('contains one group that contains two queries sorted by priority', () => {
|
2017-06-20 08:50:31 +00:00
|
|
|
expect(this.store.groups).toBeDefined();
|
|
|
|
expect(this.store.groups.length).toEqual(1);
|
2017-09-06 07:42:47 +00:00
|
|
|
expect(this.store.groups[0].metrics.length).toEqual(2);
|
2017-06-20 08:50:31 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('gets the metrics count for every group', () => {
|
|
|
|
expect(this.store.getMetricsCount()).toEqual(2);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('contains deployment data', () => {
|
|
|
|
this.store.storeDeploymentData(deploymentData);
|
|
|
|
expect(this.store.deploymentData).toBeDefined();
|
|
|
|
expect(this.store.deploymentData.length).toEqual(3);
|
|
|
|
expect(typeof this.store.deploymentData[0]).toEqual('object');
|
|
|
|
});
|
2018-07-17 20:44:26 +00:00
|
|
|
|
|
|
|
it('only stores environment data that contains deployments', () => {
|
|
|
|
this.store.storeEnvironmentsData(environmentData);
|
|
|
|
expect(this.store.environmentsData.length).toEqual(2);
|
|
|
|
});
|
2017-06-20 08:50:31 +00:00
|
|
|
});
|