refactor: adds test for registry info component (#214)

This commit is contained in:
Ayush Sharma
2019-10-25 10:45:42 +02:00
committed by GitHub
parent 4498aad4bf
commit 6dfcd70025
2 changed files with 30 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
import React from 'react';
import { mount } from 'enzyme';
import RegistryInfoContent from './RegistryInfoContent';
describe('<RegistryInfoContent /> component', () => {
test('should render the component in default state with npm tab', () => {
const wrapper = mount(<RegistryInfoContent registryUrl="https://registry.verdaccio.org" scope="@" />);
expect(wrapper.html()).toMatchSnapshot();
});
test('should render the component in default state with pnpm tab', () => {
const wrapper = mount(<RegistryInfoContent registryUrl="https://registry.verdaccio.org" scope="@" />);
wrapper.setState({ tabPosition: 1 });
expect(wrapper.html()).toMatchSnapshot();
});
test('should render the component in default state with yarn tab', () => {
const wrapper = mount(<RegistryInfoContent registryUrl="https://registry.verdaccio.org" scope="@" />);
wrapper.setState({ tabPosition: 2 });
expect(wrapper.html()).toMatchSnapshot();
});
});