import * as React from 'react';
import { shallow } from 'enzyme';
import ImageLoader from 'react-render-image';
import { PreviewView, LoadingView, NoImageView, LoadedView } from '../..';
const exampleURL = 'https://placekitten.com/g/200/300';
describe('CardPreview', () => {
it('should render the no-image view when url is undefined', () => {
const element = shallow();
expect(element.find(NoImageView)).toHaveLength(1);
expect(element.find(LoadingView)).toHaveLength(0);
expect(element.find(LoadedView)).toHaveLength(0);
});
it('should render the loading view when url is an empty string', () => {
const element = shallow();
expect(element.find(NoImageView)).toHaveLength(1);
expect(element.find(LoadingView)).toHaveLength(0);
expect(element.find(LoadedView)).toHaveLength(0);
});
it('should render the ImageLoader with all the views', () => {
const element = shallow();
const loader = element.find(ImageLoader);
expect(loader.prop('loading')).toEqual();
expect(loader.prop('loaded')).toEqual();
expect(loader.prop('errored')).toEqual();
});
});