From 336f1f8c21387a1e7f11f967c7625d309875e6d9 Mon Sep 17 00:00:00 2001
From: kagehina919 <39922958+kagehina919@users.noreply.github.com>
Date: Mon, 26 Nov 2018 21:09:08 +0530
Subject: [PATCH] Fixes date issue in snapshot test (#339)
---
.../__snapshots__/measuretable.spec.jsx.snap | 24 +++++++++----------
.../test/components/measuretable.spec.jsx | 4 ++++
2 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/frontend/test/components/__snapshots__/measuretable.spec.jsx.snap b/frontend/test/components/__snapshots__/measuretable.spec.jsx.snap
index c1c2f50..53f6b3d 100644
--- a/frontend/test/components/__snapshots__/measuretable.spec.jsx.snap
+++ b/frontend/test/components/__snapshots__/measuretable.spec.jsx.snap
@@ -180,7 +180,7 @@ ShallowWrapper {
N/A
- 2 hours ago
+ a few seconds ago
|
@@ -282,7 +282,7 @@ ShallowWrapper {
N/A
- 2 hours ago
+ a few seconds ago
|
,
@@ -520,7 +520,7 @@ ShallowWrapper {
N/A
- 2 hours ago
+ a few seconds ago
|
,
],
@@ -578,7 +578,7 @@ ShallowWrapper {
,
],
- 2 hours ago
+ a few seconds ago
| ,
],
},
@@ -699,10 +699,10 @@ ShallowWrapper {
"key": undefined,
"nodeType": "host",
"props": Object {
- "children": "2 hours ago",
+ "children": "a few seconds ago",
},
"ref": null,
- "rendered": "2 hours ago",
+ "rendered": "a few seconds ago",
"type": "td",
},
],
@@ -806,7 +806,7 @@ ShallowWrapper {
N/A
- 2 hours ago
+ a few seconds ago
|
@@ -908,7 +908,7 @@ ShallowWrapper {
N/A
- 2 hours ago
+ a few seconds ago
|
,
@@ -1146,7 +1146,7 @@ ShallowWrapper {
N/A
- 2 hours ago
+ a few seconds ago
|
,
],
@@ -1204,7 +1204,7 @@ ShallowWrapper {
,
],
- 2 hours ago
+ a few seconds ago
| ,
],
},
@@ -1325,10 +1325,10 @@ ShallowWrapper {
"key": undefined,
"nodeType": "host",
"props": Object {
- "children": "2 hours ago",
+ "children": "a few seconds ago",
},
"ref": null,
- "rendered": "2 hours ago",
+ "rendered": "a few seconds ago",
"type": "td",
},
],
diff --git a/frontend/test/components/measuretable.spec.jsx b/frontend/test/components/measuretable.spec.jsx
index 1977f88..922ba99 100644
--- a/frontend/test/components/measuretable.spec.jsx
+++ b/frontend/test/components/measuretable.spec.jsx
@@ -2,6 +2,10 @@ import { shallow, configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import MeasureTable from '../../ui/measuretable';
+const referenceDate = new Date('2018-11-20T15:00:00Z');
+
+Date.now = jest.fn(() => referenceDate.getTime());
+
configure({ adapter: new Adapter() });
describe('MeasureTable', () => {
it('should render the measures table correctly', () => {