Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 18 additions & 11 deletions tests/gemini.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1500,21 +1500,28 @@ describe("Gemini Component", () => {
});

test("should handle clearExpiredSummary with exactly 24 hours", async () => {
const exactTimestamp = Date.now() - 86400 * 1000;
const now = Date.now();
const dateNowSpy = jest.spyOn(Date, "now").mockReturnValue(now);

mockChromeStorage({
summaryList: [{ name: "Place", clue: "" }],
timestamp: exactTimestamp,
favoriteList: [],
});
try {
const exactTimestamp = now - 86400 * 1000;

geminiInstance.clearExpiredSummary();
mockChromeStorage({
summaryList: [{ name: "Place", clue: "" }],
timestamp: exactTimestamp,
favoriteList: [],
});

geminiInstance.clearExpiredSummary();

// Wait for the async storage callback to complete
await flushPromises();
// Wait for the async storage callback to complete
await flushPromises();

// Should not clear (exactly 24 hours is still valid - elapsedTime > 86400 is false)
expect(state.hasSummary).toBe(true);
// Should not clear (exactly 24 hours is still valid - elapsedTime > 86400 is false)
expect(state.hasSummary).toBe(true);
} finally {
dateNowSpy.mockRestore();
}
});

test("should handle video summary requests", async () => {
Expand Down
Loading