1
0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-11-13 03:35:52 +01:00
verdaccio/test/unit/webui/modules/home.spec.js

40 lines
909 B
JavaScript
Raw Normal View History

/**
* Home Component
*/
import React from 'react';
import { mount } from 'enzyme';
import Home from '../../../../src/webui/modules/home/index';
describe('<Home /> Component', () => {
let wrapper;
beforeEach(() => {
wrapper = mount(<Home />);
});
it('handleSearchInput - should match the search query', () => {
const { handleSearchInput } = wrapper.instance();
const result = 'test query string one';
const input = {
target: {
value: result
}
};
handleSearchInput(input);
expect(wrapper.state('query')).toBe(result);
});
it('handleSearchInput - should match the trimmed search query', () => {
const { handleSearchInput } = wrapper.instance();
const result = ' ';
const input = {
target: {
value: result
}
};
handleSearchInput(input);
expect(wrapper.state('query')).toBe(result.trim());
});
});