2020-12-20 14:17:12 +03:00
|
|
|
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([
|
2022-03-26 14:17:42 +03:00
|
|
|
[undefined, MAIN_COLOR],
|
|
|
|
['red', 'red'],
|
|
|
|
['white', 'white'],
|
2020-12-20 14:17:12 +03:00
|
|
|
])('renders expected color', (color, expectedColor) => {
|
|
|
|
const wrapper = createWrapper({ color });
|
|
|
|
|
|
|
|
expect(wrapper.find('g').prop('fill')).toEqual(expectedColor);
|
|
|
|
});
|
|
|
|
|
|
|
|
it.each([
|
2022-03-26 14:17:42 +03:00
|
|
|
[undefined, undefined],
|
|
|
|
['foo', 'foo'],
|
|
|
|
['bar', 'bar'],
|
2020-12-20 14:17:12 +03:00
|
|
|
])('renders expected class', (className, expectedClassName) => {
|
|
|
|
const wrapper = createWrapper({ className });
|
|
|
|
|
|
|
|
expect(wrapper.prop('className')).toEqual(expectedClassName);
|
|
|
|
});
|
|
|
|
});
|