feat: add CLI Apps settings MVP
This commit is contained in:
@@ -2,10 +2,12 @@ import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
import {
|
||||
deleteSession,
|
||||
fetchCliApps,
|
||||
fetchSidebarState,
|
||||
fetchWebuiThread,
|
||||
listSessions,
|
||||
listSlashCommands,
|
||||
runCliAppAction,
|
||||
updateSidebarState,
|
||||
updateImageGenerationSettings,
|
||||
updateProviderSettings,
|
||||
@@ -116,6 +118,33 @@ describe("webui API helpers", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("reads CLI Apps catalog and serializes actions", async () => {
|
||||
vi.mocked(fetch).mockResolvedValueOnce({
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
apps: [],
|
||||
installed_count: 0,
|
||||
catalog_updated_at: "2026-04-18",
|
||||
}),
|
||||
} as Response);
|
||||
|
||||
await expect(fetchCliApps("tok")).resolves.toMatchObject({ apps: [] });
|
||||
expect(fetch).toHaveBeenCalledWith(
|
||||
"/api/settings/cli-apps",
|
||||
expect.objectContaining({
|
||||
headers: { Authorization: "Bearer tok" },
|
||||
}),
|
||||
);
|
||||
|
||||
await runCliAppAction("tok", "install", "gimp");
|
||||
expect(fetch).toHaveBeenCalledWith(
|
||||
"/api/settings/cli-apps/install?name=gimp",
|
||||
expect.objectContaining({
|
||||
headers: { Authorization: "Bearer tok" },
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it("reads and writes persisted sidebar state", async () => {
|
||||
const state = {
|
||||
schema_version: 1,
|
||||
|
||||
Reference in New Issue
Block a user