summaryrefslogtreecommitdiff
path: root/spec/frontend/monitoring/store/actions_spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/monitoring/store/actions_spec.js')
-rw-r--r--spec/frontend/monitoring/store/actions_spec.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/frontend/monitoring/store/actions_spec.js b/spec/frontend/monitoring/store/actions_spec.js
index d4bc613ffea..467e0445a90 100644
--- a/spec/frontend/monitoring/store/actions_spec.js
+++ b/spec/frontend/monitoring/store/actions_spec.js
@@ -1,4 +1,5 @@
import MockAdapter from 'axios-mock-adapter';
+import Tracking from '~/tracking';
import { TEST_HOST } from 'helpers/test_constants';
import testAction from 'helpers/vuex_action_helper';
import axios from '~/lib/utils/axios_utils';
@@ -226,12 +227,14 @@ describe('Monitoring store actions', () => {
let state;
const response = metricsDashboardResponse;
beforeEach(() => {
+ jest.spyOn(Tracking, 'event');
dispatch = jest.fn();
state = storeState();
state.dashboardEndpoint = '/dashboard';
});
it('dispatches receive and success actions', done => {
const params = {};
+ document.body.dataset.page = 'projects:environments:metrics';
mock.onGet(state.dashboardEndpoint).reply(200, response);
fetchDashboard(
{
@@ -246,6 +249,17 @@ describe('Monitoring store actions', () => {
response,
params,
});
+ })
+ .then(() => {
+ expect(Tracking.event).toHaveBeenCalledWith(
+ document.body.dataset.page,
+ 'dashboard_fetch',
+ {
+ label: 'custom_metrics_dashboard',
+ property: 'count',
+ value: 0,
+ },
+ );
done();
})
.catch(done.fail);