Skip to content

Commit

Permalink
fix date string
Browse files Browse the repository at this point in the history
Signed-off-by: Chenyang Ji <[email protected]>
  • Loading branch information
ansjcy committed Jan 14, 2025
1 parent 02e1c64 commit 7572e04
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
9 changes: 9 additions & 0 deletions public/pages/QueryDetails/QueryDetails.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ const mockQuery = MockQueries()[0];
const mockParams = { hashedQuery: hash(mockQuery) };

describe('QueryDetails component', () => {
beforeAll(() => {
jest.spyOn(Date.prototype, 'toLocaleTimeString').mockImplementation(() => '12:00:00 AM');
jest.spyOn(Date.prototype, 'toDateString').mockImplementation(() => 'Mon Jan 13 2025');
});

afterAll(() => {
jest.resetAllMocks(); // Reset all mocks after all tests
});

beforeEach(() => {
jest.clearAllMocks(); // Clear all mock calls and instances before each test
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ exports[`QueryDetails component renders the QueryDetails page 1`] = `
<div
class="euiText euiText--extraSmall"
>
Sep 12, 2024 @ 3:09:55 PM
Jan 13, 2025 @ 12:00:00 AM
</div>
</div>
<div
Expand Down
9 changes: 9 additions & 0 deletions public/pages/QueryInsights/QueryInsights.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ const renderQueryInsights = () =>
);

describe('QueryInsights Component', () => {
beforeAll(() => {
jest.spyOn(Date.prototype, 'toLocaleTimeString').mockImplementation(() => '12:00:00 AM');
jest.spyOn(Date.prototype, 'toDateString').mockImplementation(() => 'Mon Jan 13 2025');
});

afterAll(() => {
jest.resetAllMocks(); // Reset all mocks after all tests
});

beforeEach(() => {
jest.clearAllMocks();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ exports[`QueryInsights Component renders the table with the correct columns and
class="euiLink euiLink--primary"
type="button"
>
Sep 12, 2024 @ 3:09:55 PM
Jan 13, 2025 @ 12:00:00 AM
</button>
</span>
</div>
Expand Down

0 comments on commit 7572e04

Please sign in to comment.