mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-02-17 23:45:29 -05:00
fix: dynamic date generation for <Package /> component test
fix: adds <Package /> component snapshot
This commit is contained in:
parent
8e16bbc5f1
commit
e5ea0c2f5b
2 changed files with 12 additions and 1 deletions
|
@ -1,3 +1,3 @@
|
||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// 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>"`;
|
||||||
|
|
|
@ -7,11 +7,22 @@ import { mount } from 'enzyme';
|
||||||
import Package from '../../../src/webui/src/components/Package';
|
import Package from '../../../src/webui/src/components/Package';
|
||||||
import { BrowserRouter } from 'react-router-dom';
|
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', () => {
|
describe('<Package /> component', () => {
|
||||||
it('should load the component', () => {
|
it('should load the component', () => {
|
||||||
const props = {
|
const props = {
|
||||||
name: 'verdaccio',
|
name: 'verdaccio',
|
||||||
version: '1.0.0',
|
version: '1.0.0',
|
||||||
|
time: dateOneMonthAgo(),
|
||||||
license: 'MIT',
|
license: 'MIT',
|
||||||
description: 'Private NPM repository',
|
description: 'Private NPM repository',
|
||||||
author: { name: 'Sam' }
|
author: { name: 'Sam' }
|
||||||
|
|
Loading…
Add table
Reference in a new issue