12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- import {mountWithTheme, shallow} from 'sentry-test/enzyme';
- import {initializeOrg} from 'sentry-test/initializeOrg';
- import {TeamCreate} from 'sentry/views/teamCreate';
- describe('TeamCreate', function () {
- describe('render()', function () {
- it('renders correctly', function () {
- const {organization, routerContext} = initializeOrg();
- const wrapper = mountWithTheme(
- <TeamCreate
- organization={organization}
- params={{
- orgId: 'org',
- }}
- />,
- routerContext
- );
- expect(wrapper).toSnapshot();
- });
- });
- describe('handleSubmitSuccess()', function () {
- let wrapper;
- const redirectMock = jest.fn();
- beforeEach(function () {
- redirectMock.mockReset();
- wrapper = shallow(
- <TeamCreate
- router={{
- push: redirectMock,
- }}
- params={{
- orgId: 'org',
- }}
- />,
- {
- context: {
- router: TestStubs.router(),
- organization: {
- id: '1337',
- },
- },
- }
- );
- });
- it('redirects to team settings', function () {
- wrapper.setContext({
- organization: {
- id: '1337',
- },
- });
- wrapper.instance().handleSubmitSuccess({
- slug: 'new-team',
- });
- expect(redirectMock).toHaveBeenCalledWith('/settings/org/teams/new-team/');
- });
- });
- });
|