diff options
author | Adriel Santiago <asantiago@gitlab.com> | 2019-04-19 02:09:15 +0300 |
---|---|---|
committer | Clement Ho <clemmakesapps@gmail.com> | 2019-04-19 02:09:15 +0300 |
commit | d753db3f14fa3c0949f172283a8db487d68f35a8 (patch) | |
tree | 27fde8d1312d120e5f86d7d85776535e2d84f5b6 /spec/javascripts/monitoring | |
parent | e9bf3672dff56cf845114856a17ea72328215bcf (diff) |
Resolve cluster metrics regression
Fixes a regression causing cluster metrics not to display
Diffstat (limited to 'spec/javascripts/monitoring')
-rw-r--r-- | spec/javascripts/monitoring/monitoring_store_spec.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/javascripts/monitoring/monitoring_store_spec.js b/spec/javascripts/monitoring/monitoring_store_spec.js index d8a980c874d..5bf6937c92e 100644 --- a/spec/javascripts/monitoring/monitoring_store_spec.js +++ b/spec/javascripts/monitoring/monitoring_store_spec.js @@ -32,4 +32,28 @@ describe('MonitoringStore', () => { it('removes the data if all the values from a query are not defined', () => { expect(store.groups[1].metrics[0].queries[0].result.length).toEqual(0); }); + + it('assigns queries a metric id', () => { + expect(store.groups[1].metrics[0].queries[0].metricId).toEqual('100'); + }); + + it('assigns metric id of null if metric has no id', () => { + const noId = MonitoringMock.data.map(group => ({ + ...group, + ...{ + metrics: group.metrics.map(metric => { + const { id, ...metricWithoutId } = metric; + + return metricWithoutId; + }), + }, + })); + store.storeMetrics(noId); + + store.groups.forEach(group => { + group.metrics.forEach(metric => { + expect(metric.queries.every(query => query.metricId === null)).toBe(true); + }); + }); + }); }); |