2018-09-11 07:14:03 -05:00
|
|
|
import React from 'react';
|
|
|
|
import { shallow } from 'enzyme';
|
|
|
|
import { TeamPages, Props } from './TeamPages';
|
2018-11-15 06:37:29 -06:00
|
|
|
import { NavModel, Team } from '../../types';
|
2018-09-11 07:14:03 -05:00
|
|
|
import { getMockTeam } from './__mocks__/teamMocks';
|
|
|
|
|
|
|
|
jest.mock('app/core/config', () => ({
|
|
|
|
buildInfo: { isEnterprise: true },
|
|
|
|
}));
|
|
|
|
|
|
|
|
const setup = (propOverrides?: object) => {
|
|
|
|
const props: Props = {
|
|
|
|
navModel: {} as NavModel,
|
|
|
|
teamId: 1,
|
|
|
|
loadTeam: jest.fn(),
|
|
|
|
pageName: 'members',
|
|
|
|
team: {} as Team,
|
|
|
|
};
|
|
|
|
|
|
|
|
Object.assign(props, propOverrides);
|
|
|
|
|
|
|
|
const wrapper = shallow(<TeamPages {...props} />);
|
|
|
|
const instance = wrapper.instance();
|
|
|
|
|
|
|
|
return {
|
|
|
|
wrapper,
|
|
|
|
instance,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
describe('Render', () => {
|
|
|
|
it('should render component', () => {
|
|
|
|
const { wrapper } = setup();
|
|
|
|
|
|
|
|
expect(wrapper).toMatchSnapshot();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should render member page if team not empty', () => {
|
|
|
|
const { wrapper } = setup({
|
|
|
|
team: getMockTeam(),
|
|
|
|
});
|
|
|
|
|
|
|
|
expect(wrapper).toMatchSnapshot();
|
|
|
|
});
|
|
|
|
|
2018-11-12 13:58:59 -06:00
|
|
|
it('should render settings and preferences page', () => {
|
2018-09-11 07:14:03 -05:00
|
|
|
const { wrapper } = setup({
|
|
|
|
team: getMockTeam(),
|
|
|
|
pageName: 'settings',
|
2018-11-12 13:58:59 -06:00
|
|
|
preferences: {
|
|
|
|
homeDashboardId: 1,
|
|
|
|
theme: 'Default',
|
|
|
|
timezone: 'Default',
|
|
|
|
},
|
2018-09-11 07:14:03 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
expect(wrapper).toMatchSnapshot();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should render group sync page', () => {
|
|
|
|
const { wrapper } = setup({
|
|
|
|
team: getMockTeam(),
|
|
|
|
pageName: 'groupsync',
|
|
|
|
});
|
|
|
|
|
|
|
|
expect(wrapper).toMatchSnapshot();
|
|
|
|
});
|
|
|
|
});
|