Skip to content

Commit

Permalink
fix: set local time zone as the same as Melbourne
Browse files Browse the repository at this point in the history
  • Loading branch information
PengchengYuGithub committed Dec 12, 2022
1 parent 44b39f5 commit 8440d10
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/__tests__/pages/orders/orderHeader.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const OrderHeaderInfoMockData = {
describe("<OrderHeader />", () => {
it("should render order Header component correctly", () => {
renderWithMockedProvider(<OrderHeader {...OrderHeaderInfoMockData} />);
// expect(screen.getByText("Create Date: 2022-11-12 11:00:00")).toBeVisible();
expect(screen.getByText("Create Date: 2022-11-12 11:00:00")).toBeVisible();

This comment has been minimized.

Copy link
@tatoMa

tatoMa Dec 12, 2022

Contributor

It is not easy to deal with local time testing. We usually use MockDate but It is okay if you only monitor the result showing on the screen without verifying the text.

If you want to dig it deep, however, have a look at this article:
https://bengry.medium.com/testing-dates-and-timezones-using-jest-10a6a6ecf375

expect(screen.getByText("Order #: 636fbb07d8e97844f6905732")).toBeVisible();
expect(screen.getByText("Account ID: 63624a518991ae3a2a678e8d")).toBeVisible();
});
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/pages/orders/orderItemFooter.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const OrderFooterInfoMockData = {
describe("<OrderItemFooter />", () => {
it("should render order Footer component correctly", () => {
renderWithMockedProvider(<OrderItemFooter totalQuotation={""} {...OrderFooterInfoMockData} />);
// expect(screen.getByText("2022-11-12 20:26:55")).toBeVisible();
expect(screen.getByText("2022-11-12 20:26:55")).toBeVisible();
expect(screen.getByText("0.02")).toBeVisible();
});
});

0 comments on commit 8440d10

Please sign in to comment.