-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
29 additions
and
3 deletions.
There are no files selected for viewing
4 changes: 2 additions & 2 deletions
4
...ublic/components/overview/monitor_list/__tests__/__snapshots__/monitor_list.test.tsx.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
/* global jest */ | ||
|
||
import moment from 'moment'; | ||
import { Moment } from 'moment-timezone'; | ||
|
||
export function mockMoment() { | ||
// avoid timezone issues | ||
jest.spyOn(moment.prototype, 'format').mockImplementation(function (this: Moment) { | ||
return `Sept 4, 2020 9:31:38 AM`; | ||
}); | ||
|
||
// convert relative time to absolute time to avoid timing issues | ||
jest.spyOn(moment.prototype, 'fromNow').mockImplementation(function (this: Moment) { | ||
return `15 minutes ago`; | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters