mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-11-13 03:35:52 +01:00
9f6106cfe9
* 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
87 lines
2.2 KiB
JavaScript
87 lines
2.2 KiB
JavaScript
/**
|
|
* Package component
|
|
*/
|
|
|
|
import React from 'react';
|
|
import { shallow } from 'enzyme';
|
|
import Package from '../../../../src/webui/components/Package/index';
|
|
import Tag from '../../../../src/webui/components/Tag/index';
|
|
import { Version, Wrapper, Field, OverviewItem } from '../../../../src/webui/components/Package/styles';
|
|
|
|
|
|
/**
|
|
* Generates one month back date from current time
|
|
* @return {object} date object
|
|
*/
|
|
const dateOneMonthAgo = () => new Date(1544377770747)
|
|
|
|
describe('<Package /> component', () => {
|
|
it.skip('should load the component', () => {
|
|
const props = {
|
|
name: 'verdaccio',
|
|
version: '1.0.0',
|
|
time: dateOneMonthAgo(),
|
|
license: 'MIT',
|
|
description: 'Private NPM repository',
|
|
author: {
|
|
name: 'Sam'
|
|
},
|
|
keywords: [
|
|
"verdaccio"
|
|
]
|
|
};
|
|
|
|
const wrapper = shallow(
|
|
<Package {...props} />
|
|
);
|
|
|
|
|
|
// integration expectations
|
|
|
|
// check link
|
|
expect(wrapper.find(Wrapper).prop('to')).toEqual(`detail/${props.name}`);
|
|
|
|
// check version
|
|
expect(wrapper.find(Version).prop('children')).toEqual(`v${props.version}`);
|
|
|
|
// TODO - REWRITE THE TEST
|
|
//expect(wrapper.find(Author).dive())
|
|
|
|
// check description
|
|
expect(wrapper.find(Field).someWhere(n => {
|
|
return (
|
|
n.children().first().get(0).props.children[0].props.text === 'Description' &&
|
|
n.children().childAt(1).containsMatchingElement(<span>{props.description}</span>)
|
|
)
|
|
})).toBe(true);
|
|
|
|
// check license
|
|
expect(wrapper.find(OverviewItem).someWhere(n => n.get(0).props.children[1] === props.license)).toBe(true);
|
|
|
|
// check keyword
|
|
expect(wrapper.find(Tag).prop('children')).toEqual(props.keywords[0]);
|
|
|
|
});
|
|
|
|
it.skip('should load the component without author', () => {
|
|
const props = {
|
|
name: 'verdaccio',
|
|
version: '1.0.0',
|
|
time: dateOneMonthAgo(),
|
|
license: 'MIT',
|
|
author: {
|
|
name: 'Anonymous',
|
|
email: '',
|
|
avatar: ''
|
|
},
|
|
description: 'Private NPM repository'
|
|
};
|
|
const wrapper = shallow(
|
|
<Package {...props} />
|
|
);
|
|
|
|
// integration expectations
|
|
expect(wrapper.html()).toMatchSnapshot();
|
|
});
|
|
});
|