Skip to content

Commit 4886d14

Browse files
committed
fix: abs paths in tests
1 parent 54d475c commit 4886d14

File tree

10 files changed

+22
-58
lines changed

10 files changed

+22
-58
lines changed

src/components/__tests__/ChatHeader.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import React from "react"
22
import { render } from "ink-testing-library"
33
import { test, expect, describe } from "bun:test"
4-
import { ChatHeader } from "../ChatHeader"
5-
import { AgentStore } from "../../store"
4+
import { ChatHeader } from "components/ChatHeader"
5+
import { AgentStore } from "store"
66

77
describe("ChatHeader", () => {
88
test("should render title", () => {

src/components/__tests__/Stats.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import React from "react"
22
import { render } from "ink-testing-library"
33
import { test, expect, describe } from "bun:test"
4-
import { Stats } from "../Stats"
5-
import { AgentStore } from "../../store"
4+
import { Stats } from "components/Stats"
5+
import { AgentStore } from "store"
66

77
describe("Stats", () => {
88
test("should display stats string", () => {

src/components/__tests__/ToolPermissionPrompt.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import React from "react"
22
import { render } from "ink-testing-library"
33
import { test, expect, describe } from "bun:test"
4-
import { ToolPermissionPrompt } from "../ToolPermissionPrompt"
5-
import { AgentStore } from "../../store"
4+
import { ToolPermissionPrompt } from "components/ToolPermissionPrompt"
5+
import { AgentStore } from "store"
66

77
describe("ToolPermissionPrompt", () => {
88
test("should not render when no pending permission", () => {

src/components/__tests__/ToolUses.test.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import React from "react"
22
import { render } from "ink-testing-library"
33
import { test, expect, describe } from "bun:test"
4-
import { ToolUses } from "../ToolUses"
5-
import { AgentStore } from "../../store"
6-
import type { ToolUse } from "../../store"
4+
import { ToolUses } from "components/ToolUses"
5+
import { AgentStore } from "store"
6+
import type { ToolUse } from "store"
77

88
describe("ToolUses", () => {
99
test("should display MCP tool with server name", () => {

src/components/__tests__/UserInput.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import React from "react"
22
import { render } from "ink-testing-library"
33
import { test, expect, describe } from "bun:test"
4-
import { UserInput } from "../UserInput"
5-
import { AgentStore } from "../../store"
4+
import { UserInput } from "components/UserInput"
5+
import { AgentStore } from "store"
66

77
describe("UserInput", () => {
88
test("should render input field", () => {

src/hooks/__tests__/useCycleMessages.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import React from "react"
22
import { render } from "ink-testing-library"
33
import { test, expect, describe } from "bun:test"
4-
import { useCycleMessages } from "../useCycleMessages"
5-
import { AgentStore } from "../../store"
4+
import { useCycleMessages } from "hooks/useCycleMessages"
5+
import { AgentStore } from "store"
66

77
describe("useCycleMessages", () => {
88
test("should initialize with no messages", () => {

src/utils/__tests__/getPrompt.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { test, expect, describe } from "bun:test"
2-
import { getPrompt, buildSystemPrompt } from "../getPrompt"
3-
import type { AgentChatConfig } from "../../store"
2+
import { getPrompt, buildSystemPrompt } from "utils/getPrompt"
3+
import type { AgentChatConfig } from "store"
44

55
describe("getPrompt", () => {
66
test("should load system prompt from file", () => {

src/utils/__tests__/getToolInfo.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import {
33
getToolInfo,
44
getDisallowedTools,
55
isToolDisallowed,
6-
} from "../getToolInfo"
7-
import type { AgentChatConfig } from "../../store"
6+
} from "utils/getToolInfo"
7+
import type { AgentChatConfig } from "store"
88

99
describe("getToolInfo", () => {
1010
test("should extract server name and tool name from MCP format", () => {

src/utils/__tests__/validateEnv.test.ts

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ describe("validateEnv", () => {
2121

2222
test("should pass when all required environment variables are present", () => {
2323
process.env.ANTHROPIC_API_KEY = "test-key"
24-
process.env.ARTSY_MCP_X_ACCESS_TOKEN = "test-token"
25-
process.env.ARTSY_MCP_X_USER_ID = "test-user"
2624
process.env.GITHUB_ACCESS_TOKEN = "test-github"
2725

2826
validateEnv()
@@ -33,32 +31,6 @@ describe("validateEnv", () => {
3331

3432
test("should exit when ANTHROPIC_API_KEY is missing", () => {
3533
delete process.env.ANTHROPIC_API_KEY
36-
process.env.ARTSY_MCP_X_ACCESS_TOKEN = "test-token"
37-
process.env.ARTSY_MCP_X_USER_ID = "test-user"
38-
process.env.GITHUB_ACCESS_TOKEN = "test-github"
39-
40-
validateEnv()
41-
42-
expect(consoleErrorSpy).toHaveBeenCalled()
43-
expect(processExitSpy).toHaveBeenCalledWith(1)
44-
})
45-
46-
test("should exit when ARTSY_MCP_X_ACCESS_TOKEN is missing", () => {
47-
process.env.ANTHROPIC_API_KEY = "test-key"
48-
delete process.env.ARTSY_MCP_X_ACCESS_TOKEN
49-
process.env.ARTSY_MCP_X_USER_ID = "test-user"
50-
process.env.GITHUB_ACCESS_TOKEN = "test-github"
51-
52-
validateEnv()
53-
54-
expect(consoleErrorSpy).toHaveBeenCalled()
55-
expect(processExitSpy).toHaveBeenCalledWith(1)
56-
})
57-
58-
test("should exit when ARTSY_MCP_X_USER_ID is missing", () => {
59-
process.env.ANTHROPIC_API_KEY = "test-key"
60-
process.env.ARTSY_MCP_X_ACCESS_TOKEN = "test-token"
61-
delete process.env.ARTSY_MCP_X_USER_ID
6234
process.env.GITHUB_ACCESS_TOKEN = "test-github"
6335

6436
validateEnv()
@@ -69,8 +41,6 @@ describe("validateEnv", () => {
6941

7042
test("should exit when GITHUB_ACCESS_TOKEN is missing", () => {
7143
process.env.ANTHROPIC_API_KEY = "test-key"
72-
process.env.ARTSY_MCP_X_ACCESS_TOKEN = "test-token"
73-
process.env.ARTSY_MCP_X_USER_ID = "test-user"
7444
delete process.env.GITHUB_ACCESS_TOKEN
7545

7646
validateEnv()
@@ -81,8 +51,6 @@ describe("validateEnv", () => {
8151

8252
test("should exit when all environment variables are missing", () => {
8353
delete process.env.ANTHROPIC_API_KEY
84-
delete process.env.ARTSY_MCP_X_ACCESS_TOKEN
85-
delete process.env.ARTSY_MCP_X_USER_ID
8654
delete process.env.GITHUB_ACCESS_TOKEN
8755

8856
validateEnv()
@@ -94,8 +62,6 @@ describe("validateEnv", () => {
9462
test("should display helpful error message with missing variables", () => {
9563
delete process.env.ANTHROPIC_API_KEY
9664
delete process.env.GITHUB_ACCESS_TOKEN
97-
process.env.ARTSY_MCP_X_ACCESS_TOKEN = "test-token"
98-
process.env.ARTSY_MCP_X_USER_ID = "test-user"
9965

10066
validateEnv()
10167

src/utils/validateEnv.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
11
export function validateEnv() {
22
const requiredEnvVars = {
33
ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY,
4-
ARTSY_MCP_X_ACCESS_TOKEN: process.env.ARTSY_MCP_X_ACCESS_TOKEN,
5-
ARTSY_MCP_X_USER_ID: process.env.ARTSY_MCP_X_USER_ID,
64
GITHUB_ACCESS_TOKEN: process.env.GITHUB_ACCESS_TOKEN,
7-
};
5+
}
86

97
const missingVars = Object.entries(requiredEnvVars)
108
.filter(([_, value]) => !value)
11-
.map(([key]) => key);
9+
.map(([key]) => key)
1210

1311
if (missingVars.length > 0) {
1412
console.error(
1513
`\n[agent-cli] Missing required environment variables:\n${missingVars
1614
.map((v) => ` - ${v}`)
1715
.join("\n")}\n`
18-
);
19-
console.error("Please copy .env.example to .env and fill in the values.\n");
20-
process.exit(1);
16+
)
17+
console.error("Please copy .env.example to .env and fill in the values.\n")
18+
process.exit(1)
2119
}
2220
}

0 commit comments

Comments
 (0)