0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-16 21:56:25 -05:00

Merge pull request #769 from ayusharma/fixes-package-component-time-issue-webui-test

fix: dynamic date generation for <Package /> component test
This commit is contained in:
Juan Picado @jotadeveloper 2018-06-19 07:58:06 +02:00 committed by GitHub
commit 9a862dd704
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View file

@ -1,3 +1,3 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`<Package /> component should load the component 1`] = `"<section class=\\"package\\"><a href=\\"detail/verdaccio\\"><div class=\\"header\\"><div class=\\"title\\"><h1>verdaccio <span class=\\"el-tag el-tag--gray\\">v1.0.0</span></h1></div><div role=\\"author\\" class=\\"author\\">By: Sam</div></div><div class=\\"footer\\"><p class=\\"description\\">Private NPM repository</p></div><div class=\\"details\\"><div class=\\"license\\">MIT</div></div></a></section>"`;
exports[`<Package /> component should load the component 1`] = `"<section class=\\"package\\"><a href=\\"detail/verdaccio\\"><div class=\\"header\\"><div class=\\"title\\"><h1>verdaccio <span class=\\"el-tag el-tag--gray\\">v1.0.0</span></h1></div><div role=\\"author\\" class=\\"author\\">By: Sam</div></div><div class=\\"footer\\"><p class=\\"description\\">Private NPM repository</p></div><div class=\\"details\\"><div class=\\"homepage\\">Published about 1 month ago</div><div class=\\"license\\">MIT</div></div></a></section>"`;

View file

@ -7,11 +7,22 @@ import { mount } from 'enzyme';
import Package from '../../../src/webui/src/components/Package';
import { BrowserRouter } from 'react-router-dom';
/**
* Generates one month back date from current time
* @return {object} date object
*/
const dateOneMonthAgo = () => {
const date = new Date();
date.setMonth(date.getMonth() - 1);
return date;
}
describe('<Package /> component', () => {
it('should load the component', () => {
const props = {
name: 'verdaccio',
version: '1.0.0',
time: dateOneMonthAgo(),
license: 'MIT',
description: 'Private NPM repository',
author: { name: 'Sam' }