1
0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-11-13 03:35:52 +01:00
verdaccio/test/unit/webui/components/packagelist.spec.js
Priscila 9d265996f9 Refactor: Moved Search to Header (#1064)
* refactor: Moved Search to Header

feat: added TxtField. WIP

refactor: replaced downshift by react-autosuggest

refactor: moved search's state

refactor: introduced weight 300 & 500

refactor: changed container css margin

refactor: made it more abstract

refactor: replaced name by label. changed css

refactor: removed aria

refactor: removed margin

fix: fixed flow  types

fix: fixed tags overlapping

fix: fixed search. WIP

refactor: removed useless library and added rect-router

refactor: fixed tests

* chore: remove tpm file

* feat: added component Loading

feat: added component Layout

refactor: changed css

refactor: added md prop

refactor: moved Header back to App

* chore: fix flow

* fix: update snapshot

fix: fixed componentDidMount parameter

refactor: added onKeyDown event

fix: fixed bad request

refactor: renamed interfaces files

refactor: refactor: logic display results

refactor: changed minor things

fix: fixed tests

fix: fixed tests
2018-10-27 21:19:45 +02:00

67 lines
1.6 KiB
JavaScript

/**
* PackageList component
*/
import React from 'react';
import { mount } from 'enzyme';
import PackageList from '../../../../src/webui/components/PackageList/index';
import { BrowserRouter } from 'react-router-dom';
describe('<PackageList /> component', () => {
it('should load the component with no packages', () => {
const props = {
packages: [],
help: true
};
const wrapper = mount(
<PackageList packages={props.packages} help={props.help} />
);
expect(wrapper.find('Help')).toHaveLength(1);
expect(wrapper.find('h1').text()).toEqual('No Package Published Yet');
});
it('should load the component with packages', () => {
const props = {
packages: [
{
name: 'verdaccio',
version: '1.0.0',
time: new Date(),
description: 'Private NPM repository',
author: { name: 'Sam' }
},
{
name: 'abc',
version: '1.0.1',
time: new Date(),
description: 'abc description',
author: { name: 'Rose' }
},
{
name: 'xyz',
version: '1.1.0',
description: 'xyz description',
author: { name: 'Martin' }
}
],
help: false
};
const wrapper = mount(
<BrowserRouter>
<PackageList packages={props.packages} help={props.help} />
</BrowserRouter>
);
expect(wrapper.find('.listTitle').text()).toContain('Available Packages');
// package count
expect(wrapper.find('Package')).toHaveLength(3);
// match snapshot
expect(wrapper.html()).toMatchSnapshot();
});
});