mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-19 10:36:26 +02:00
test(connections): cover bounded history and fix Storybook selector types
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
e1e83b51dd
commit
925d203823
2 files changed
+12
-2
No files matched your search
@@ -3,7 +3,7 @@ import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
import { GROK_SYNC_ALLOWLIST, stageGrokHomeForSync } from "./grok-home.js";
|
||||
import { GROK_SYNC_ALLOWLIST, grokHomeHasSession, stageGrokHomeForSync } from "./grok-home.js";
|
||||
|
||||
describe("GROK_SYNC_ALLOWLIST", () => {
|
||||
it("holds exactly one name: auth.json", () => {
|
||||
@@ -29,6 +29,16 @@ describe("stageGrokHomeForSync", () => {
|
||||
return root;
|
||||
}
|
||||
|
||||
it("starts fresh instead of throwing when private history exceeds the lookup bound", async () => {
|
||||
const root = await makeRoot("paperclip-grok-large-history-");
|
||||
const sessions = path.join(root, "sessions");
|
||||
await fs.mkdir(sessions);
|
||||
for (let offset = 0; offset < 5001; offset += 100) {
|
||||
await Promise.all(Array.from({ length: Math.min(100, 5001 - offset) }, (_, index) => fs.writeFile(path.join(sessions, `other-${offset + index}.json`), "{}")));
|
||||
}
|
||||
await expect(grokHomeHasSession(root, "requested-session")).resolves.toBe(false);
|
||||
});
|
||||
|
||||
it("stages auth.json and stages no other file", async () => {
|
||||
const root = await makeRoot("paperclip-grok-stage-");
|
||||
const home = path.join(root, "grok-home");
|
||||
|
||||
@@ -105,7 +105,7 @@ export const CustomEndpointWalkthrough: Story = {
|
||||
"https://models.example.com/v1",
|
||||
);
|
||||
await userEvent.type(canvas.getByLabelText("API key"), "storybook-example");
|
||||
await userEvent.click(canvas.getByRole("button", { name: "Connect", exact: true }));
|
||||
await userEvent.click(canvas.getByRole("button", { name: /^Connect$/ }));
|
||||
await expect(
|
||||
canvas.getByRole("heading", { name: "Connection ready" }),
|
||||
).toBeVisible();
|
||||
|
||||
Reference in new issue
Block a user