Tests: restore stale detail response coverage

This commit is contained in:
joshavant
2026-04-09 21:11:36 -05:00
committed by Josh Avant
parent a59f270178
commit 5613913e8e

View File

@@ -1,6 +1,7 @@
import { describe, expect, it, vi } from "vitest";
import {
installSkill,
loadClawHubDetail,
saveSkillApiKey,
searchClawHub,
setClawHubSearchQuery,
@@ -156,6 +157,29 @@ describe("searchClawHub", () => {
});
});
describe("loadClawHubDetail", () => {
it("ignores stale detail responses after slug changes", async () => {
const { state, request } = createState();
const queue = createDeferredRequestQueue(request);
const firstPending = loadClawHubDetail(state, "github");
const secondPending = loadClawHubDetail(state, "gitlab");
queue.resolveNext({
skill: { slug: "github", displayName: "GitHub", createdAt: 1, updatedAt: 2 },
});
await firstPending;
queue.resolveNext({
skill: { slug: "gitlab", displayName: "GitLab", createdAt: 3, updatedAt: 4 },
});
await secondPending;
expect(state.clawhubDetailLoading).toBe(false);
expect(state.clawhubDetail?.skill?.slug).toBe("gitlab");
});
});
describe("skill mutations", () => {
it.each([
{