diff options
author | Martin Hanzel <mhanzel@gitlab.com> | 2019-07-17 20:47:39 +0300 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2019-07-17 20:47:39 +0300 |
commit | eb45cb8c99f4232da90c26b307eff35c926d1975 (patch) | |
tree | a1e14c5f34baae8257b4774b6d2b610b8e08284f /spec/frontend/mocks_spec.js | |
parent | 48195a517183560cdc673273440c7d757cf40821 (diff) |
Mockify jquery and axios packages
Moved the block that fails tests on unmocked axios requests from
test_setup to its own mock, and added a jQuery mock that fails
tests if they use unmocked $.ajax().
Diffstat (limited to 'spec/frontend/mocks_spec.js')
-rw-r--r-- | spec/frontend/mocks_spec.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/frontend/mocks_spec.js b/spec/frontend/mocks_spec.js new file mode 100644 index 00000000000..2d2324120fd --- /dev/null +++ b/spec/frontend/mocks_spec.js @@ -0,0 +1,13 @@ +import $ from 'jquery'; +import axios from '~/lib/utils/axios_utils'; + +describe('Mock auto-injection', () => { + describe('mocks', () => { + it('~/lib/utils/axios_utils', () => + expect(axios.get('http://gitlab.com')).rejects.toThrow('Unexpected unmocked request')); + + it('jQuery.ajax()', () => { + expect($.ajax).toThrow('Unexpected unmocked'); + }); + }); +}); |