Copy Jest config from Mastodon and fix tests

stable/1.0.x
Alex Gleason 2020-04-14 17:45:07 -05:00
rodzic f99f026474
commit d4b63072bf
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
3 zmienionych plików z 33 dodań i 34 usunięć

Wyświetl plik

@ -18,6 +18,7 @@ exports[`<DisplayName /> renders display name + account name 1`] = `
className="display-name__account"
>
@
bar@baz
</span>
</span>
`;

Wyświetl plik

@ -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 100644
Wyświetl plik

@ -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',
],
};