mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-12 09:41:11 +00:00
Tests: restore stale detail response coverage
This commit is contained in:
@@ -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([
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user