it("stores without consentCardActivityId when not provided", () => { const id = storePendingUpload({
buffer: Buffer.from("data"),
filename: "file.txt",
conversationId: "conv-1",
});
it("clears the TTL timer so it does not fire after explicit removal", () => { const id = storePendingUpload({
buffer: Buffer.from("data"),
filename: "file.txt",
conversationId: "conv-1",
});
// Advance past TTL — timer should have been cleared and count stays 0
vi.advanceTimersByTime(5 * 60 * 1000 + 1);
expect(getPendingUploadCount()).toBe(0);
});
it("is a no-op for undefined id", () => {
storePendingUpload({
buffer: Buffer.from("data"),
filename: "file.txt",
conversationId: "conv-1",
});
// TTL timers should have been cleared — no side-effects after advance
vi.advanceTimersByTime(5 * 60 * 1000 + 1);
expect(getPendingUploadCount()).toBe(0);
});
});
describe("setPendingUploadActivityId", () => {
it("sets the consentCardActivityId on an existing upload", () => { const id = storePendingUpload({
buffer: Buffer.from("data"),
filename: "file.txt",
conversationId: "conv-1",
});
it("returns undefined for unknown id", () => {
expect(getPendingUpload("no-such-id")).toBeUndefined();
});
it("returns undefined when entry is past TTL but timer has not yet fired", () => { const id = storePendingUpload({
buffer: Buffer.from("data"),
filename: "file.txt",
conversationId: "conv-1",
});
// Manually advance time without firing timers to simulate stale entry
vi.setSystemTime(Date.now() + 5 * 60 * 1000 + 1);
expect(getPendingUpload(id)).toBeUndefined();
});
});
});
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.