From e5ea0c2f5b9e8b5c00e6b24589c83dd67a214277 Mon Sep 17 00:00:00 2001 From: ayusharma Date: Mon, 18 Jun 2018 23:31:38 +0200 Subject: [PATCH] fix: dynamic date generation for component test fix: adds component snapshot --- .../components/__snapshots__/package.spec.js.snap | 2 +- test/webui/components/package.spec.js | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/test/webui/components/__snapshots__/package.spec.js.snap b/test/webui/components/__snapshots__/package.spec.js.snap index 53f06132a..da1f16773 100644 --- a/test/webui/components/__snapshots__/package.spec.js.snap +++ b/test/webui/components/__snapshots__/package.spec.js.snap @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[` component should load the component 1`] = `"

verdaccio v1.0.0

By: Sam

Private NPM repository

MIT
"`; +exports[` component should load the component 1`] = `"

verdaccio v1.0.0

By: Sam

Private NPM repository

Published about 1 month ago
MIT
"`; diff --git a/test/webui/components/package.spec.js b/test/webui/components/package.spec.js index 4e9533d3a..235d4265e 100644 --- a/test/webui/components/package.spec.js +++ b/test/webui/components/package.spec.js @@ -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(' 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' }