[Uptime] Fixed failing unit test because of timestamp in snapshot (#52302)

* fixed test

* update snaps
This commit is contained in:
Shahzad 2019-12-05 19:30:48 +01:00 committed by GitHub
parent 9f024b8067
commit 931cf220c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View file

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`MostRecentError component renders properly with empty data 1`] = `
exports[`MostRecentError component renders properly with mock data 1`] = `
Array [
<div
class="euiText euiText--extraSmall"

View file

@ -6,6 +6,7 @@
import { shallowWithIntl, renderWithIntl } from 'test_utils/enzyme_helpers';
import React from 'react';
import moment from 'moment';
import { BrowserRouter as Router } from 'react-router-dom';
import { MostRecentError } from '../most_recent_error';
import { MonitorDetails, MonitorError } from '../../../../../../common/runtime_types';
@ -14,6 +15,10 @@ describe('MostRecentError component', () => {
let monitorDetails: MonitorDetails;
let monitorError: MonitorError;
beforeAll(() => {
moment.prototype.fromNow = jest.fn(() => '5 days ago');
});
beforeEach(() => {
monitorError = {
type: 'io',
@ -39,7 +44,7 @@ describe('MostRecentError component', () => {
expect(component).toMatchSnapshot();
});
it.skip('renders properly with empty data', () => {
it('renders properly with mock data', () => {
const component = renderWithIntl(
<Router>
<MostRecentError