the universal sandbox runtime for agents and humans. pocketenv.io
sandbox openclaw agent claude-code vercel-sandbox deno-sandbox cloudflare-sandbox atproto sprites daytona
7
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 56 lines 1.4 kB view raw
1import { vi, describe, it, expect, beforeEach } from "vitest"; 2import consola from "consola"; 3import { Sandbox } from "@pocketenv/sdk"; 4import ps from "./ps"; 5 6vi.mock("../lib/sdk", () => ({ configureSdk: vi.fn() })); 7vi.mock("../theme", () => ({ 8 c: { 9 primary: (s: string | number) => String(s), 10 secondary: (s: string | number) => String(s), 11 highlight: (s: string | number) => String(s), 12 }, 13})); 14vi.mock("consola", () => ({ 15 default: { log: vi.fn(), success: vi.fn(), error: vi.fn() }, 16})); 17vi.mock("@pocketenv/sdk", () => ({ 18 Sandbox: { get: vi.fn(), list: vi.fn(), configure: vi.fn() }, 19})); 20 21describe("ps", () => { 22 beforeEach(() => { 23 vi.clearAllMocks(); 24 }); 25 26 it("lists only running sandboxes", async () => { 27 vi.mocked(Sandbox.list).mockResolvedValue({ 28 sandboxes: [ 29 { 30 name: "running-sandbox", 31 baseSandbox: "base", 32 status: "RUNNING", 33 startedAt: new Date().toISOString(), 34 createdAt: new Date().toISOString(), 35 }, 36 ], 37 } as any); 38 39 await ps(); 40 41 expect(Sandbox.list).toHaveBeenCalledWith({ 42 limit: 100, 43 offset: 0, 44 isRunning: true, 45 }); 46 expect(consola.log).toHaveBeenCalledOnce(); 47 }); 48 49 it("logs an empty table when no running sandboxes", async () => { 50 vi.mocked(Sandbox.list).mockResolvedValue({ sandboxes: [] } as any); 51 52 await ps(); 53 54 expect(consola.log).toHaveBeenCalledOnce(); 55 }); 56});