import * as React from 'react';
import { mount, shallow } from 'enzyme';
import Link from '../Link';
const theme = {
external: 'external',
url: 'https://www.google.co.in',
children: 'children',
};
describe('', () => {
describe('onClick()', () => {
it('should verify the Link is clicked', () => {
const spy = jest.fn();
const linkWrapper = shallow(
Test
);
linkWrapper.simulate('click');
});
});
describe('external property', () => {
describe('when not set', () => {
it('should not have external element', () => {
const linkWrapper = mount(
);
expect(linkWrapper.find('external')).toHaveLength(0);
});
it('should external element is undfine', () => {
const linkWrapper = mount(
);
expect(linkWrapper.prop('external')).toBeUndefined();
});
});
describe('when set to true', () => {
it('should verify the external is true', () => {
const linkWrapper = mount(
);
expect(linkWrapper.prop('external')).toBe(true);
});
});
describe('when set to false', () => {
it('should verify the external is false', () => {
const linkWrapper = mount(
);
expect(linkWrapper.prop('external')).toBe(false);
});
});
});
describe('url prop', () => {
describe('when set', () => {
it('should verify the url', () => {
const linkWrapper = mount(
);
expect(linkWrapper.prop('url')).toBe(theme.url);
});
});
describe('when not set', () => {
it('should verify the url', () => {
const linkWrapper = mount(
);
expect(linkWrapper.prop('url')).toBeUndefined();
});
it('should not have url element', () => {
const linkWrapper = mount(
);
expect(linkWrapper.find('url')).toHaveLength(0);
});
});
});
describe('set children property', () => {
it('should verify children text', () => {
const linkWrapper = mount(
Please click here
);
expect(linkWrapper.prop('children')).toBe('Please click here');
});
});
});