Skip to content

Commit

Permalink
Mock prototype in unit test to prevent relative date breaking snapsho…
Browse files Browse the repository at this point in the history
…ts. (#73531)
  • Loading branch information
justinkambic authored Jul 28, 2020
1 parent f61df05 commit 86b60bb
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 86b60bb

Please sign in to comment.