Move emoji_menu_spec.js to Jest
This commit is contained in:
parent
7c4940b702
commit
5c4cf3b3a3
4 changed files with 7 additions and 3 deletions
|
@ -1,3 +1,4 @@
|
|||
import '~/commons/bootstrap';
|
||||
import { AwardsHandler } from '~/awards_handler';
|
||||
|
||||
class EmojiMenu extends AwardsHandler {
|
||||
|
|
|
@ -16,6 +16,7 @@ module.exports = {
|
|||
testMatch: ['<rootDir>/spec/frontend/**/*_spec.js'],
|
||||
moduleNameMapper: {
|
||||
'^~(.*)$': '<rootDir>/app/assets/javascripts$1',
|
||||
'^helpers(.*)$': '<rootDir>/spec/frontend/helpers$1',
|
||||
},
|
||||
collectCoverageFrom: ['<rootDir>/app/assets/javascripts/**/*.{js,vue}'],
|
||||
coverageDirectory: '<rootDir>/coverage-frontend/',
|
||||
|
|
2
spec/frontend/helpers/test_constants.js
Normal file
2
spec/frontend/helpers/test_constants.js
Normal file
|
@ -0,0 +1,2 @@
|
|||
// eslint-disable-next-line import/prefer-default-export
|
||||
export const TEST_HOST = 'http://test.host';
|
|
@ -1,7 +1,7 @@
|
|||
import $ from 'jquery';
|
||||
import axios from '~/lib/utils/axios_utils';
|
||||
import EmojiMenu from '~/pages/profiles/show/emoji_menu';
|
||||
import { TEST_HOST } from 'spec/test_constants';
|
||||
import { TEST_HOST } from 'helpers/test_constants';
|
||||
|
||||
describe('EmojiMenu', () => {
|
||||
const dummyEmojiTag = '<dummy></tag>';
|
||||
|
@ -56,7 +56,7 @@ describe('EmojiMenu', () => {
|
|||
});
|
||||
|
||||
it('does not make an axios requst', done => {
|
||||
spyOn(axios, 'request').and.stub();
|
||||
jest.spyOn(axios, 'request').mockReturnValue();
|
||||
|
||||
emojiMenu.addAward(dummyVotesBlock(), dummyAwardUrl, dummyEmoji, false, () => {
|
||||
expect(axios.request).not.toHaveBeenCalled();
|
||||
|
@ -67,7 +67,7 @@ describe('EmojiMenu', () => {
|
|||
|
||||
describe('bindEvents', () => {
|
||||
beforeEach(() => {
|
||||
spyOn(emojiMenu, 'registerEventListener').and.stub();
|
||||
jest.spyOn(emojiMenu, 'registerEventListener').mockReturnValue();
|
||||
});
|
||||
|
||||
it('binds event listeners to custom toggle button', () => {
|
Loading…
Reference in a new issue