12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- import React from 'react';
- import {shallow} from 'enzyme';
- import {TeamCreate} from 'app/views/teamCreate';
- describe('TeamCreate', function() {
- describe('render()', function() {
- it('renders correctly', function() {
- const wrapper = shallow(
- <TeamCreate
- params={{
- orgId: 'org',
- }}
- />,
- {
- context: {router: TestStubs.router(), organization: TestStubs.Organization()},
- }
- );
- expect(wrapper).toMatchSnapshot();
- });
- });
- 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/');
- });
- });
- });
|