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

64 lines
1.6 KiB
JavaScript
Raw Normal View History

/**
* PackageList component
*/
import React from 'react';
import { mount } from 'enzyme';
import PackageList from '../../../../src/webui/components/PackageList/index';
import Help from '../../../../src/webui/components/Help/index';
import { BrowserRouter } from 'react-router-dom';
describe('<PackageList /> component', () => {
2018-12-05 19:30:08 +01:00
test('should load the component with no packages', () => {
const props = {
packages: [],
help: true
};
const wrapper = mount(
<PackageList help={props.help} packages={props.packages} />
);
expect(wrapper.find(Help).exists()).toBeTruthy();
});
2018-12-05 19:30:08 +01:00
test('should load the component with packages', () => {
const props = {
packages: [
{
name: 'verdaccio',
version: '1.0.0',
Package Refactor (#1145) * chore: fix unit test, forgotten line on merge chore: add node 11 to circleci (#1153) chore: fix the use of Node 11 in CircleCI (#1154) refactor: added css in js, new design, added types feat: added Tag component refactor: added modifiers refactor: replaced by polished ellipsis refactor: added types, new design and css in js refactor: removed ul. it needs refactor refactor: changed media queries refactor: changed icon height refactor: changed Header media queries refactor: removed margin top refactor: updated snapshots refactor: removed unnecessary format author refactor: added license icon & changed size refactor: changed media queries refactor: added icon size refactor: changed media queries refactor: updated snap refactor: replaced Description by Details refactor: updated tests refactor: fixed modifiers type feat: created missed types fix: fixed types fix: fixed prop type fix: fixed undefined prop refactor: replaced label by name refactor: updated snap refactor: moved polished to dev refactor: changed formatAuthor and pkg author type fix: removed incorrect meta's type refactor: removed polished refactor: added spacing & ellipsis mixin refactor: added modifier type refactor: changed datetime format refactor: updated snapshots refactor: rreplaced polished by mixins func * refactor: updated styled * fix: added missed semicolon * refactor: updated media * refactor: updated tests * refactor: organized modifiers * refactor: removed unused imports * refactor: design adjusts * refactor: updated snapshot * refactor: changed minor things * refactor: updated snapshots * refactor: commented tests. fix later
2018-12-13 19:05:47 +01:00
time: new Date(1532211072138).getTime(),
description: 'Private NPM repository',
author: { name: 'Sam' }
},
{
name: 'abc',
version: '1.0.1',
Package Refactor (#1145) * chore: fix unit test, forgotten line on merge chore: add node 11 to circleci (#1153) chore: fix the use of Node 11 in CircleCI (#1154) refactor: added css in js, new design, added types feat: added Tag component refactor: added modifiers refactor: replaced by polished ellipsis refactor: added types, new design and css in js refactor: removed ul. it needs refactor refactor: changed media queries refactor: changed icon height refactor: changed Header media queries refactor: removed margin top refactor: updated snapshots refactor: removed unnecessary format author refactor: added license icon & changed size refactor: changed media queries refactor: added icon size refactor: changed media queries refactor: updated snap refactor: replaced Description by Details refactor: updated tests refactor: fixed modifiers type feat: created missed types fix: fixed types fix: fixed prop type fix: fixed undefined prop refactor: replaced label by name refactor: updated snap refactor: moved polished to dev refactor: changed formatAuthor and pkg author type fix: removed incorrect meta's type refactor: removed polished refactor: added spacing & ellipsis mixin refactor: added modifier type refactor: changed datetime format refactor: updated snapshots refactor: rreplaced polished by mixins func * refactor: updated styled * fix: added missed semicolon * refactor: updated media * refactor: updated tests * refactor: organized modifiers * refactor: removed unused imports * refactor: design adjusts * refactor: updated snapshot * refactor: changed minor things * refactor: updated snapshots * refactor: commented tests. fix later
2018-12-13 19:05:47 +01:00
time: new Date(1532211072138).getTime(),
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 help={props.help} packages={props.packages} />
</BrowserRouter>
);
// package count
expect(wrapper.find('Package')).toHaveLength(3);
// match snapshot
expect(wrapper.html()).toMatchSnapshot();
});
});