Copy Jest config from Mastodon and fix tests
This commit is contained in:
parent
f99f026474
commit
d4b63072bf
3 changed files with 33 additions and 34 deletions
|
@ -18,6 +18,7 @@ exports[`<DisplayName /> renders display name + account name 1`] = `
|
|||
className="display-name__account"
|
||||
>
|
||||
@
|
||||
bar@baz
|
||||
</span>
|
||||
</span>
|
||||
`;
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
import React from 'react';
|
||||
import { mount } from 'enzyme';
|
||||
import Column from '../column';
|
||||
import ColumnHeader from '../column_header';
|
||||
|
||||
describe('<Column />', () => {
|
||||
describe('<ColumnHeader /> click handler', () => {
|
||||
const originalRaf = global.requestAnimationFrame;
|
||||
|
||||
beforeEach(() => {
|
||||
global.requestAnimationFrame = jest.fn();
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
global.requestAnimationFrame = originalRaf;
|
||||
});
|
||||
|
||||
xit('runs the scroll animation if the column contains scrollable content', () => {
|
||||
const wrapper = mount(
|
||||
<Column heading='notifications'>
|
||||
<div className='scrollable' />
|
||||
</Column>
|
||||
);
|
||||
wrapper.find(ColumnHeader).find('button').simulate('click');
|
||||
expect(global.requestAnimationFrame.mock.calls.length).toEqual(1);
|
||||
});
|
||||
|
||||
xit('does not try to scroll if there is no scrollable content', () => {
|
||||
const wrapper = mount(<Column heading='notifications' />);
|
||||
wrapper.find(ColumnHeader).find('button').simulate('click');
|
||||
expect(global.requestAnimationFrame.mock.calls.length).toEqual(0);
|
||||
});
|
||||
});
|
||||
});
|
32
jest.config.js
Normal file
32
jest.config.js
Normal file
|
@ -0,0 +1,32 @@
|
|||
module.exports = {
|
||||
'projects': [
|
||||
'<rootDir>/app/gabsocial',
|
||||
],
|
||||
'testPathIgnorePatterns': [
|
||||
'<rootDir>/node_modules/',
|
||||
'<rootDir>/vendor/',
|
||||
'<rootDir>/config/',
|
||||
'<rootDir>/log/',
|
||||
'<rootDir>/public/',
|
||||
'<rootDir>/tmp/',
|
||||
'<rootDir>/webpack/',
|
||||
],
|
||||
'setupFiles': [
|
||||
'raf/polyfill',
|
||||
],
|
||||
'setupFilesAfterEnv': [
|
||||
'<rootDir>/app/gabsocial/test_setup.js',
|
||||
],
|
||||
'collectCoverageFrom': [
|
||||
'app/gabsocial/**/*.js',
|
||||
'!app/gabsocial/features/emoji/emoji_compressed.js',
|
||||
'!app/gabsocial/locales/locale-data/*.js',
|
||||
'!app/gabsocial/service_worker/entry.js',
|
||||
'!app/gabsocial/test_setup.js',
|
||||
],
|
||||
'coverageDirectory': '<rootDir>/coverage',
|
||||
'moduleDirectories': [
|
||||
'<rootDir>/node_modules',
|
||||
'<rootDir>/app',
|
||||
],
|
||||
};
|
Loading…
Reference in a new issue