gitlab-org--gitlab-foss/spec/frontend/mocks/node/jquery.js
Martin Hanzel eb45cb8c99 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().
2019-07-17 17:47:39 +00:00

13 lines
303 B
JavaScript

/* eslint-disable import/no-commonjs */
const $ = jest.requireActual('jquery');
// Fail tests for unmocked requests
$.ajax = () => {
throw new Error(
'Unexpected unmocked jQuery.ajax() call! Make sure to mock jQuery.ajax() in tests.',
);
};
// jquery is not an ES6 module
module.exports = $;