@orfeas126/box-ui-elements
Version:
Box UI Elements
101 lines (93 loc) • 2.79 kB
JavaScript
import * as React from 'react';
import { shallow } from 'enzyme';
import { ANYONE_WITH_LINK, ANYONE_IN_COMPANY, PEOPLE_IN_ITEM } from '../constants';
import SharedLinkAccessDescription from '../SharedLinkAccessDescription';
describe('features/unified-share-modal/SharedLinkAccessDescription', () => {
describe('people with link', () => {
[
{
itemType: 'file',
},
{
itemType: 'folder',
},
{
itemType: 'hubs',
},
].forEach(({ itemType }) => {
test('should render correct description', () => {
const wrapper = shallow(
<SharedLinkAccessDescription
accessLevel={ANYONE_WITH_LINK}
enterpriseName="Box"
itemType={itemType}
/>,
);
expect(wrapper).toMatchSnapshot();
});
});
});
describe('people in company', () => {
[
{
itemType: 'file',
name: '',
},
{
itemType: 'file',
name: 'Box',
},
{
itemType: 'folder',
name: '',
},
{
itemType: 'folder',
name: 'Box',
},
{
itemType: 'hubs',
name: '',
},
{
itemType: 'hubs',
name: 'Box',
},
].forEach(({ itemType, name }) => {
test('should render correct description', () => {
const wrapper = shallow(
<SharedLinkAccessDescription
accessLevel={ANYONE_IN_COMPANY}
enterpriseName={name}
itemType={itemType}
/>,
);
expect(wrapper).toMatchSnapshot();
});
});
});
describe('people in item', () => {
[
{
itemType: 'file',
},
{
itemType: 'folder',
},
{
itemType: 'hubs',
},
].forEach(({ itemType }) => {
test('should render correct description', () => {
const wrapper = shallow(
<SharedLinkAccessDescription
accessLevel={PEOPLE_IN_ITEM}
enterpriseName="Box"
itemType={itemType}
/>,
);
expect(wrapper).toMatchSnapshot();
});
});
});
});