summaryrefslogtreecommitdiff
path: root/spec/javascripts/vue_mr_widget
diff options
context:
space:
mode:
authorLukas Eipert <leipert@gitlab.com>2019-01-23 10:59:49 +0100
committerLukas Eipert <leipert@gitlab.com>2019-01-23 10:59:49 +0100
commit7db474ff78a86389c7fd4aea0ffd64a293add0cc (patch)
treeb13a04879f50139f093f264e2e3765cd98162921 /spec/javascripts/vue_mr_widget
parent85002b6a7fc415b92efc44a4403f684d25dbc21c (diff)
downloadgitlab-ce-7db474ff78a86389c7fd4aea0ffd64a293add0cc.tar.gz
Remove favicon check from mrWidgetOptions spec
The method that actually creates the favicon is already unit tested, I would have loved to mock it out, but ist is not possible without using rewire. So I decided we just check that the favicon href is changed and use that as a proxy for calling `setFaviconOverlay`
Diffstat (limited to 'spec/javascripts/vue_mr_widget')
-rw-r--r--spec/javascripts/vue_mr_widget/mr_widget_options_spec.js22
1 files changed, 16 insertions, 6 deletions
diff --git a/spec/javascripts/vue_mr_widget/mr_widget_options_spec.js b/spec/javascripts/vue_mr_widget/mr_widget_options_spec.js
index 99b80df766a..c7be2079476 100644
--- a/spec/javascripts/vue_mr_widget/mr_widget_options_spec.js
+++ b/spec/javascripts/vue_mr_widget/mr_widget_options_spec.js
@@ -5,7 +5,7 @@ import notify from '~/lib/utils/notify';
import { stateKey } from '~/vue_merge_request_widget/stores/state_maps';
import mountComponent from 'spec/helpers/vue_mount_component_helper';
import mockData from './mock_data';
-import { faviconDataUrl, overlayDataUrl, faviconWithOverlayDataUrl } from '../lib/utils/mock_data';
+import { faviconDataUrl, overlayDataUrl } from '../lib/utils/mock_data';
const returnPromise = data =>
new Promise(resolve => {
@@ -340,17 +340,27 @@ describe('mrWidgetOptions', () => {
vm.mr.ciStatusFaviconPath = overlayDataUrl;
vm.setFaviconHelper()
.then(() => {
- expect(faviconElement.getAttribute('href')).toEqual(faviconWithOverlayDataUrl);
+ /*
+ It would be better if we'd could mock commonUtils.setFaviconURL
+ with a spy and test that it was called. We are doing the following
+ tests as a proxy to show that the function has been called
+ */
+ expect(faviconElement.getAttribute('href')).not.toEqual(null);
+ expect(faviconElement.getAttribute('href')).not.toEqual(overlayDataUrl);
+ expect(faviconElement.getAttribute('href')).not.toEqual(faviconDataUrl);
done();
})
.catch(done.fail);
});
- it('should not call setFavicon when there is no ciStatusFaviconPath', () => {
+ it('should not call setFavicon when there is no ciStatusFaviconPath', done => {
vm.mr.ciStatusFaviconPath = null;
- vm.setFaviconHelper();
-
- expect(faviconElement.getAttribute('href')).toEqual(null);
+ vm.setFaviconHelper()
+ .then(() => {
+ expect(faviconElement.getAttribute('href')).toEqual(null);
+ done();
+ })
+ .catch(done.fail);
});
});