xchain-components
Version:
Xchain Components
45 lines (42 loc) • 1.15 kB
JavaScript
/* eslint react/jsx-filename-extension: 0 */
import React from 'react';
import { shallow } from 'enzyme';
import XSearch from '..';
const handleResultFn = jest.fn();
const handleSearchChangeFn = jest.fn();
describe('XSearch', () => {
const results = {
card: {
name: 'card',
results: [
{
title: 'Hackett, Dickens and Pagac',
description: 'Exclusive zero administration migration',
image: 'https://s3.amazonaws.com/uifaces/faces/twitter/mocabyte/128.jpg',
price: '$24.64',
},
],
},
'hard drive': {
name: 'hard drive',
results: [
{
title: 'Hansen - Hoppe',
description: 'Diverse next generation conglomeration',
image: 'https://s3.amazonaws.com/uifaces/faces/twitter/geshan/128.jpg',
price: '$34.32',
},
],
},
};
it('Search Bar', () => {
const component = shallow(<XSearch
value="ha"
results={results}
handleResultSelect={handleResultFn}
handleSearchChange={handleSearchChangeFn}
isLoading
/>);
expect(component).toMatchSnapshot();
});
});