Skip to content

Commit 931cf22

Browse files
authored
[Uptime] Fixed failing unit test because of timestamp in snapshot (#52302)
* fixed test * update snaps
1 parent 9f024b8 commit 931cf22

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

x-pack/legacy/plugins/uptime/public/components/functional/monitor_list/monitor_list_drawer/__tests__/__snapshots__/most_recent_error.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x-pack/legacy/plugins/uptime/public/components/functional/monitor_list/monitor_list_drawer/__tests__/most_recent_error.test.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import { shallowWithIntl, renderWithIntl } from 'test_utils/enzyme_helpers';
88
import React from 'react';
9+
import moment from 'moment';
910
import { BrowserRouter as Router } from 'react-router-dom';
1011
import { MostRecentError } from '../most_recent_error';
1112
import { MonitorDetails, MonitorError } from '../../../../../../common/runtime_types';
@@ -14,6 +15,10 @@ describe('MostRecentError component', () => {
1415
let monitorDetails: MonitorDetails;
1516
let monitorError: MonitorError;
1617

18+
beforeAll(() => {
19+
moment.prototype.fromNow = jest.fn(() => '5 days ago');
20+
});
21+
1722
beforeEach(() => {
1823
monitorError = {
1924
type: 'io',
@@ -39,7 +44,7 @@ describe('MostRecentError component', () => {
3944
expect(component).toMatchSnapshot();
4045
});
4146

42-
it.skip('renders properly with empty data', () => {
47+
it('renders properly with mock data', () => {
4348
const component = renderWithIntl(
4449
<Router>
4550
<MostRecentError

0 commit comments

Comments
 (0)