mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2024-12-24 09:58:21 +03:00
34 lines
976 B
TypeScript
34 lines
976 B
TypeScript
import { shallow, ShallowWrapper } from 'enzyme';
|
|
import { ShlinkLogo, ShlinkLogoProps } from '../../../src/common/img/ShlinkLogo';
|
|
import { MAIN_COLOR } from '../../../src/utils/theme';
|
|
|
|
describe('<ShlinkLogo />', () => {
|
|
let wrapper: ShallowWrapper;
|
|
const createWrapper = (props: ShlinkLogoProps) => {
|
|
wrapper = shallow(<ShlinkLogo {...props} />);
|
|
|
|
return wrapper;
|
|
};
|
|
|
|
afterEach(() => wrapper?.unmount());
|
|
|
|
it.each([
|
|
[ undefined, MAIN_COLOR ],
|
|
[ 'red', 'red' ],
|
|
[ 'white', 'white' ],
|
|
])('renders expected color', (color, expectedColor) => {
|
|
const wrapper = createWrapper({ color });
|
|
|
|
expect(wrapper.find('g').prop('fill')).toEqual(expectedColor);
|
|
});
|
|
|
|
it.each([
|
|
[ undefined, undefined ],
|
|
[ 'foo', 'foo' ],
|
|
[ 'bar', 'bar' ],
|
|
])('renders expected class', (className, expectedClassName) => {
|
|
const wrapper = createWrapper({ className });
|
|
|
|
expect(wrapper.prop('className')).toEqual(expectedClassName);
|
|
});
|
|
});
|