Files
copilotkit__copilotkit/packages/v1/cli/test/commands/create.test.ts
Jordan Ritter f36dcc708f fix: resolve pre-existing bugs in CLI package
- base-command: wrap checkCLIVersion() fetch in try-catch so CLI
  doesn't crash when offline (version check is non-critical)
- init: forward argv to Create instead of dropping all flags, remove
  misleading flag definitions (init is just a deprecated redirect)
- detect-endpoint-type: fix Promise.all destructuring (5 promises but
  only 4 variables caused isCopilot to receive the LangGraph FastAPI
  result), add missing isMCP branch, use isLangGraphFastAPI result
- auth.service: validate OAuth state parameter before tracking analytics
  with user data, add reject()+server.close() on state mismatch so the
  Promise settles instead of hanging the CLI forever
- create.test: fix quote-style assertion to match prettier output
2026-03-12 13:06:03 -07:00

31 lines
1.2 KiB
TypeScript

import { describe, test, expect } from "@jest/globals";
import fs from "fs";
import path from "path";
const createCommandPath = path.join(__dirname, "../../src/commands/create.ts");
const createCommandSource = fs.readFileSync(createCommandPath, "utf8");
describe("Create Command - Cloudless flow", () => {
test("does not depend on AuthService or analytics", () => {
expect(createCommandSource).not.toContain("AuthService");
expect(createCommandSource).not.toContain("AnalyticsService");
expect(createCommandSource).not.toContain("createTRPCClient");
expect(createCommandSource).not.toContain("requireLogin");
});
test("does not mention automatic cloud sign-up messaging", () => {
expect(createCommandSource).not.toContain("Setting up your cloud account");
expect(createCommandSource).not.toContain("Retrieving your API key");
expect(createCommandSource).toContain(
"Your project is ready to explore CopilotKit locally",
);
});
test("supports creating projects in the current directory", () => {
expect(createCommandSource).toMatch(/projectName === ["']\.["']/);
expect(createCommandSource).toContain(
"You are already inside your new project directory",
);
});
});