mirror of
https://github.com/getpaseo/paseo.git
synced 2026-07-29 12:01:31 +00:00
chore(lint): no-shadow in app test hoisted blocks
This commit is contained in:
@@ -106,18 +106,15 @@ class StartupScenario {
|
||||
const createAgentPreferences = buildStoredCreateAgentPreferences(firstHost.serverId);
|
||||
|
||||
await this.page.evaluate(
|
||||
({ keys, registry, createAgentPreferences }) => {
|
||||
({ keys, registry: storedRegistry, createAgentPreferences: storedPreferences }) => {
|
||||
const nonce = localStorage.getItem(keys.seedNonce);
|
||||
if (!nonce) {
|
||||
throw new Error("Expected e2e seed nonce before overriding startup registry.");
|
||||
}
|
||||
|
||||
localStorage.setItem(keys.e2e, "1");
|
||||
localStorage.setItem(keys.registry, JSON.stringify(registry));
|
||||
localStorage.setItem(
|
||||
"@paseo:create-agent-preferences",
|
||||
JSON.stringify(createAgentPreferences),
|
||||
);
|
||||
localStorage.setItem(keys.registry, JSON.stringify(storedRegistry));
|
||||
localStorage.setItem("@paseo:create-agent-preferences", JSON.stringify(storedPreferences));
|
||||
localStorage.setItem(keys.disableDefaultSeedOnce, nonce);
|
||||
},
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@ import type { AttachmentMetadata } from "@/attachments/types";
|
||||
import { AttachmentLightbox } from "./attachment-lightbox";
|
||||
|
||||
const { theme, imageMetadata, useAttachmentPreviewUrlMock } = vi.hoisted(() => {
|
||||
const theme = {
|
||||
const hoistedTheme = {
|
||||
spacing: { 1: 4, 2: 8, 3: 12, 4: 16 },
|
||||
iconSize: { sm: 14, md: 18, lg: 22 },
|
||||
borderWidth: { 1: 1 },
|
||||
@@ -24,7 +24,7 @@ const { theme, imageMetadata, useAttachmentPreviewUrlMock } = vi.hoisted(() => {
|
||||
},
|
||||
};
|
||||
|
||||
const imageMetadata: AttachmentMetadata = {
|
||||
const hoistedImageMetadata: AttachmentMetadata = {
|
||||
id: "img-1",
|
||||
mimeType: "image/png",
|
||||
storageType: "web-indexeddb",
|
||||
@@ -35,8 +35,8 @@ const { theme, imageMetadata, useAttachmentPreviewUrlMock } = vi.hoisted(() => {
|
||||
};
|
||||
|
||||
return {
|
||||
theme,
|
||||
imageMetadata,
|
||||
theme: hoistedTheme,
|
||||
imageMetadata: hoistedImageMetadata,
|
||||
useAttachmentPreviewUrlMock: vi.fn<(metadata: AttachmentMetadata | null) => string | null>(
|
||||
() => "blob:preview",
|
||||
),
|
||||
|
||||
@@ -14,13 +14,13 @@ import { useSessionStore, type Agent } from "@/stores/session-store";
|
||||
import { useAgentHistory } from "./use-agent-history";
|
||||
|
||||
const { mockClient, mockRuntimeStore } = vi.hoisted(() => {
|
||||
const mockClient = {
|
||||
const hoistedClient = {
|
||||
fetchAgentHistory: vi.fn(),
|
||||
};
|
||||
const mockRuntimeStore = {
|
||||
const hoistedRuntimeStore = {
|
||||
refreshAgentDirectory: vi.fn(),
|
||||
};
|
||||
return { mockClient, mockRuntimeStore };
|
||||
return { mockClient: hoistedClient, mockRuntimeStore: hoistedRuntimeStore };
|
||||
});
|
||||
|
||||
vi.mock("@/runtime/host-runtime", () => ({
|
||||
|
||||
@@ -14,25 +14,25 @@ import { checkoutStatusQueryKey, useCheckoutStatusQuery } from "./use-checkout-s
|
||||
type CheckoutStatusPayload = CheckoutStatusResponse["payload"];
|
||||
|
||||
const { mockRuntime, mockClient, checkoutStatusUpdateHandlers } = vi.hoisted(() => {
|
||||
const checkoutStatusUpdateHandlers = new Set<(message: unknown) => void>();
|
||||
const mockClient = {
|
||||
const hoistedHandlers = new Set<(message: unknown) => void>();
|
||||
const hoistedClient = {
|
||||
getCheckoutStatus: vi.fn(),
|
||||
on: vi.fn((type: string, handler: (message: unknown) => void) => {
|
||||
if (type !== "checkout_status_update") {
|
||||
return () => {};
|
||||
}
|
||||
checkoutStatusUpdateHandlers.add(handler);
|
||||
hoistedHandlers.add(handler);
|
||||
return () => {
|
||||
checkoutStatusUpdateHandlers.delete(handler);
|
||||
hoistedHandlers.delete(handler);
|
||||
};
|
||||
}),
|
||||
};
|
||||
|
||||
return {
|
||||
mockClient,
|
||||
checkoutStatusUpdateHandlers,
|
||||
mockClient: hoistedClient,
|
||||
checkoutStatusUpdateHandlers: hoistedHandlers,
|
||||
mockRuntime: {
|
||||
client: mockClient,
|
||||
client: hoistedClient,
|
||||
isConnected: true,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -28,22 +28,22 @@ interface ProvidersSnapshot {
|
||||
type HookResult = ReturnType<typeof renderProvidersSnapshotHook>["result"];
|
||||
|
||||
const { mockClient, mockRuntime, snapshotUpdateListeners } = vi.hoisted(() => {
|
||||
const snapshotUpdateListeners: ProviderSnapshotUpdateListener[] = [];
|
||||
const mockClient = {
|
||||
const hoistedListeners: ProviderSnapshotUpdateListener[] = [];
|
||||
const hoistedClient = {
|
||||
getProvidersSnapshot: vi.fn(),
|
||||
refreshProvidersSnapshot: vi.fn(),
|
||||
on: vi.fn((_event: string, listener: ProviderSnapshotUpdateListener) => {
|
||||
snapshotUpdateListeners.push(listener);
|
||||
hoistedListeners.push(listener);
|
||||
return () => {};
|
||||
}),
|
||||
};
|
||||
return {
|
||||
mockClient,
|
||||
mockClient: hoistedClient,
|
||||
mockRuntime: {
|
||||
client: mockClient,
|
||||
client: hoistedClient,
|
||||
isConnected: true,
|
||||
},
|
||||
snapshotUpdateListeners,
|
||||
snapshotUpdateListeners: hoistedListeners,
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user