-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(fix) Showing test run date on duration graph tooltip in local timezo…
…ne (#194)
- Loading branch information
Showing
6 changed files
with
56 additions
and
5 deletions.
There are no files selected for viewing
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
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
35 changes: 35 additions & 0 deletions
35
ui/src/Repository/Timeline/__tests__/RepositoryTimelineGraphTooltip.spec.tsx
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,35 @@ | ||
import "@testing-library/jest-dom/extend-expect"; | ||
import React from "react"; | ||
import { render } from "@testing-library/react"; | ||
import moment from "moment-timezone"; | ||
import RepositoryTimelineGraphTooltip from "../RepositoryTimelineGraphTooltip"; | ||
|
||
describe("RepositoryTimelineGraphTooltip", () => { | ||
beforeEach(() => { | ||
// Set the default timezone so it uses the same timezone when | ||
// running locally and when running in CI. | ||
moment.tz.setDefault("America/Chicago"); | ||
}); | ||
|
||
afterEach(() => { | ||
moment.tz.setDefault(); | ||
}); | ||
|
||
it("should display run date in local timezone", () => { | ||
const createdTimestamp = moment.utc("2020-10-02T11:03:04.580Z").toDate(); | ||
const duration = 170; | ||
const totalTestCount = 15; | ||
|
||
const props = { | ||
payload: [{ payload: { createdTimestamp, duration, totalTestCount } }], | ||
}; | ||
|
||
const { getByTestId } = render( | ||
<RepositoryTimelineGraphTooltip {...props} /> | ||
); | ||
|
||
expect(getByTestId("timeline-tooltip-run-date")).toHaveTextContent( | ||
"Oct 2nd 2020, 6:03 am" | ||
); | ||
}); | ||
}); |
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 |
---|---|---|
|
@@ -5887,6 +5887,13 @@ mkdirp@^0.5.1, mkdirp@^0.5.4, mkdirp@~0.5.1: | |
dependencies: | ||
minimist "^1.2.5" | ||
|
||
[email protected]: | ||
version "0.5.31" | ||
resolved "https://registry.yarnpkg.com/moment-timezone/-/moment-timezone-0.5.31.tgz#9c40d8c5026f0c7ab46eda3d63e49c155148de05" | ||
integrity sha512-+GgHNg8xRhMXfEbv81iDtrVeTcWt0kWmTEY1XQK14dICTXnWJnT0dxdlPspwqF3keKMVPXwayEsk1DI0AA/jdA== | ||
dependencies: | ||
moment ">= 2.9.0" | ||
|
||
[email protected]: | ||
version "2.24.0" | ||
resolved "https://registry.yarnpkg.com/moment/-/moment-2.24.0.tgz#0d055d53f5052aa653c9f6eb68bb5d12bf5c2b5b" | ||
|
@@ -5897,6 +5904,11 @@ [email protected]: | |
resolved "https://registry.yarnpkg.com/moment/-/moment-2.26.0.tgz#5e1f82c6bafca6e83e808b30c8705eed0dcbd39a" | ||
integrity sha512-oIixUO+OamkUkwjhAVE18rAMfRJNsNe/Stid/gwHSOfHrOtw9EhAY2AHvdKZ/k/MggcYELFCJz/Sn2pL8b8JMw== | ||
|
||
"moment@>= 2.9.0": | ||
version "2.29.0" | ||
resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.0.tgz#fcbef955844d91deb55438613ddcec56e86a3425" | ||
integrity sha512-z6IJ5HXYiuxvFTI6eiQ9dm77uE0gyy1yXNApVHqTcnIKfY9tIwEjlzsZ6u1LQXvVgKeTnv9Xm7NDvJ7lso3MtA== | ||
|
||
[email protected]: | ||
version "2.0.0" | ||
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" | ||
|