Commit 5c4cf3b3 authored by Winnie Hellmann's avatar Winnie Hellmann

Move emoji_menu_spec.js to Jest

parent 7c4940b7
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/',
......
// eslint-disable-next-line import/prefer-default-export
export const TEST_HOST = 'http://test.host';
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', () => {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment