Mock prototype in unit test to prevent relative date breaking snapshots. (#73531)
This commit is contained in:
parent
f61df05772
commit
86b60bbc63
|
@ -7,8 +7,13 @@
|
|||
import React from 'react';
|
||||
import { PingHistogramComponent, PingHistogramComponentProps } from '../ping_histogram';
|
||||
import { renderWithRouter, shallowWithRouter, MountWithReduxProvider } from '../../../../lib';
|
||||
import moment from 'moment';
|
||||
|
||||
describe('PingHistogram component', () => {
|
||||
beforeAll(() => {
|
||||
moment.prototype.fromNow = jest.fn(() => 'a year ago');
|
||||
});
|
||||
|
||||
const props: PingHistogramComponentProps = {
|
||||
absoluteStartDate: 1548697920000,
|
||||
absoluteEndDate: 1548700920000,
|
||||
|
|
Loading…
Reference in a new issue