Silence prop warnings in test suite

This commit is contained in:
Justin 2022-04-04 15:05:15 -04:00
parent dcc90bc99a
commit 827bca3fd6
8 changed files with 14 additions and 19 deletions

View file

@ -6,5 +6,5 @@ export default function InlineSVG({ src }) {
} }
InlineSVG.propTypes = { InlineSVG.propTypes = {
src: PropTypes.node.isRequired, src: PropTypes.oneOfType([PropTypes.string, PropTypes.object]).isRequired,
}; };

View file

@ -15,7 +15,7 @@ export default class Icon extends React.PureComponent {
static propTypes = { static propTypes = {
id: PropTypes.string, id: PropTypes.string,
src: PropTypes.string, src: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
className: PropTypes.string, className: PropTypes.string,
fixedWidth: PropTypes.bool, fixedWidth: PropTypes.bool,
}; };

View file

@ -12,7 +12,7 @@ import InlineSVG from 'react-inlinesvg';
export default class SvgIcon extends React.PureComponent { export default class SvgIcon extends React.PureComponent {
static propTypes = { static propTypes = {
src: PropTypes.string.isRequired, src: PropTypes.oneOfType([PropTypes.string, PropTypes.object]).isRequired,
alt: PropTypes.string, alt: PropTypes.string,
className: PropTypes.string, className: PropTypes.string,
}; };

View file

@ -8,18 +8,16 @@ interface IIcon {
src: string, src: string,
} }
const Icon = ({ src, alt, count, ...filteredProps }: IIcon): JSX.Element => { const Icon = ({ src, alt, count, ...filteredProps }: IIcon): JSX.Element => (
return ( <div className='relative'>
<div className='relative'> {count ? (
{count ? ( <span className='absolute -top-2 -right-3 block px-1.5 py-0.5 bg-accent-500 text-xs text-white rounded-full ring-2 ring-white'>
<span className='absolute -top-2 -right-3 block px-1.5 py-0.5 bg-accent-500 text-xs text-white rounded-full ring-2 ring-white'> {count}
{count} </span>
</span> ) : null}
) : null}
<InlineSVG src={src} title={alt} {...filteredProps} /> <InlineSVG src={src} title={alt} {...filteredProps} />
</div> </div>
); );
};
export default Icon; export default Icon;

View file

@ -1,7 +1,6 @@
import userEvent from '@testing-library/user-event'; import userEvent from '@testing-library/user-event';
import { Map as ImmutableMap } from 'immutable'; import { Map as ImmutableMap } from 'immutable';
import React from 'react'; import React from 'react';
import '@testing-library/jest-dom';
import { __stub } from 'soapbox/api'; import { __stub } from 'soapbox/api';
import { fireEvent, render, screen } from 'soapbox/jest/test-helpers'; import { fireEvent, render, screen } from 'soapbox/jest/test-helpers';

View file

@ -1,6 +1,5 @@
import userEvent from '@testing-library/user-event'; import userEvent from '@testing-library/user-event';
import React from 'react'; import React from 'react';
import '@testing-library/jest-dom';
import { __stub } from 'soapbox/api'; import { __stub } from 'soapbox/api';
import { fireEvent, render, screen, waitFor } from 'soapbox/jest/test-helpers'; import { fireEvent, render, screen, waitFor } from 'soapbox/jest/test-helpers';

View file

@ -1,6 +1,5 @@
import userEvent from '@testing-library/user-event'; import userEvent from '@testing-library/user-event';
import React from 'react'; import React from 'react';
import '@testing-library/jest-dom';
import { __stub } from 'soapbox/api'; import { __stub } from 'soapbox/api';
import { fireEvent, render, screen, waitFor } from 'soapbox/jest/test-helpers'; import { fireEvent, render, screen, waitFor } from 'soapbox/jest/test-helpers';

View file

@ -22,7 +22,7 @@ module.exports = {
'!app/soapbox/locales/locale-data/*.js', '!app/soapbox/locales/locale-data/*.js',
'!app/soapbox/service_worker/entry.js', '!app/soapbox/service_worker/entry.js',
'!app/soapbox/jest/test-setup.ts', '!app/soapbox/jest/test-setup.ts',
'!app/soapbox/jest/test-helpers.tsx', '!app/soapbox/jest/test-helpers.ts',
], ],
'coverageDirectory': '<rootDir>/coverage', 'coverageDirectory': '<rootDir>/coverage',
'moduleDirectories': [ 'moduleDirectories': [