Fix warnings and update tracability
🏗️ Build and Test JellyTau / Run Tests (push) Failing after 14s
🏗️ Build and Test JellyTau / Build Android APK (push) Has been skipped
Traceability Validation / Check Requirement Traces (push) Failing after 1s

This commit is contained in:
2026-02-28 20:54:25 +01:00
parent c5be9eb18c
commit 3a9c126dfe
59 changed files with 1285 additions and 396 deletions
+7 -2
View File
@@ -145,10 +145,10 @@ function createQueueStore() {
// Get repository handle from auth store
const authState = get(auth);
if (!authState.isAuthenticated || !authState.repository) {
if (!authState.isAuthenticated) {
throw new Error("User not authenticated");
}
const repositoryHandle = authState.repository.getHandle();
const repositoryHandle = auth.getRepository().getHandle();
// Use new Rust commands that accept IDs only
if (trackIds.length === 1) {
@@ -170,6 +170,10 @@ function createQueueStore() {
}
}
async function clear() {
set(initialState);
}
return {
subscribe,
next,
@@ -182,6 +186,7 @@ function createQueueStore() {
moveInQueue,
syncFromRust,
cleanup,
clear,
};
}
+5 -79
View File
@@ -146,87 +146,13 @@ describe("sessions store", () => {
});
});
describe("polling", () => {
it.skip("should set isPolling to true when polling starts", async () => {
describe("refresh", () => {
it("should expose a refresh method for manual session fetching", async () => {
const { sessions } = await import("./sessions");
// Mock the refresh to prevent actual API calls
vi.spyOn(sessions, "refresh").mockResolvedValue();
// Note: startPolling is not yet implemented
// sessions.startPolling(5000);
// const state = get(sessions);
// expect(state.isPolling).toBe(true);
});
it.skip("should set isPolling to false when polling stops", async () => {
const { sessions } = await import("./sessions");
vi.spyOn(sessions, "refresh").mockResolvedValue();
// Note: startPolling/stopPolling are not yet implemented
// sessions.startPolling(5000);
// sessions.stopPolling();
// const state = get(sessions);
// expect(state.isPolling).toBe(false);
});
// Note: Cannot spy on internal refresh() function as it's not exported
it.skip("should call refresh immediately when polling starts", async () => {
const { sessions } = await import("./sessions");
const refreshSpy = vi.spyOn(sessions, "refresh").mockResolvedValue();
sessions.startPolling(5000);
expect(refreshSpy).toHaveBeenCalledTimes(1);
});
// Note: Cannot spy on internal refresh() function as it's not exported
it.skip("should call refresh at intervals", async () => {
const { sessions } = await import("./sessions");
const refreshSpy = vi.spyOn(sessions, "refresh").mockResolvedValue();
sessions.startPolling(5000);
// Initial call
expect(refreshSpy).toHaveBeenCalledTimes(1);
// Advance timers by 5 seconds
await vi.advanceTimersByTime(5000);
expect(refreshSpy).toHaveBeenCalledTimes(2);
// Advance another 5 seconds
await vi.advanceTimersByTime(5000);
expect(refreshSpy).toHaveBeenCalledTimes(3);
sessions.stopPolling();
});
// Note: Cannot spy on internal refresh() function as it's not exported
it.skip("should stop previous polling when starting new polling", async () => {
const { sessions } = await import("./sessions");
const refreshSpy = vi.spyOn(sessions, "refresh").mockResolvedValue();
sessions.startPolling(5000);
await vi.advanceTimersByTime(5000);
const callsAfterFirst = refreshSpy.mock.calls.length;
// Start new polling - should stop the old one
sessions.startPolling(3000);
// Advance by the old interval
await vi.advanceTimersByTime(5000);
// Should have been called once for the new startPolling, and once after 3s
expect(refreshSpy.mock.calls.length).toBeGreaterThan(callsAfterFirst);
sessions.stopPolling();
// The store uses event-driven updates via Tauri events,
// but also exposes refresh() for manual/on-demand fetching
expect(typeof sessions.refresh).toBe("function");
});
});