fix tests
This commit is contained in:
parent
77c28553fe
commit
e77562e039
3 changed files with 28 additions and 28 deletions
|
|
@ -19,7 +19,7 @@ describe("TUIChat - @ File Search Tests", () => {
|
|||
// The @ might be in the input line or in a file search UI
|
||||
const hasAtSymbol = frame.includes("@") || frame.includes("◉ @");
|
||||
expect(hasAtSymbol).toBe(true);
|
||||
|
||||
|
||||
// Mode-specific UI
|
||||
if (mode === 'remote') {
|
||||
expect(frame).toContain("Remote Mode");
|
||||
|
|
@ -42,12 +42,12 @@ describe("TUIChat - @ File Search Tests", () => {
|
|||
|
||||
// Should show the typed text
|
||||
expect(frame).toContain("@READ");
|
||||
|
||||
|
||||
// Navigation hints only show in local mode
|
||||
if (mode === 'local') {
|
||||
expect(frame).toContain("Use ↑/↓ to navigate");
|
||||
expect(frame).toContain("↑/↓ to navigate");
|
||||
}
|
||||
|
||||
|
||||
// Mode-specific checks
|
||||
if (mode === 'remote') {
|
||||
expect(frame).toContain("Remote Mode");
|
||||
|
|
@ -70,7 +70,7 @@ describe("TUIChat - @ File Search Tests", () => {
|
|||
// Should handle multiple @ without crashing
|
||||
expect(frame).toBeDefined();
|
||||
expect(frame).toContain("@@test");
|
||||
|
||||
|
||||
// Mode-specific UI elements
|
||||
if (mode === 'remote') {
|
||||
expect(frame).toContain("Remote Mode");
|
||||
|
|
@ -93,10 +93,10 @@ describe("TUIChat - @ File Search Tests", () => {
|
|||
// Should not crash and show something
|
||||
expect(frame).toBeDefined();
|
||||
expect(frame.length).toBeGreaterThan(0);
|
||||
|
||||
|
||||
// Navigation hints only show in local mode
|
||||
if (mode === 'local') {
|
||||
expect(frame).toContain("Use ↑/↓ to navigate");
|
||||
expect(frame).toContain("↑/↓ to navigate");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
@ -23,7 +23,7 @@ describe("TUIChat - Remote Server Tests", () => {
|
|||
<AppRoot remoteUrl="http://localhost:3000" />
|
||||
);
|
||||
const frame = lastFrame();
|
||||
|
||||
|
||||
expect(frame).toBeDefined();
|
||||
expect(frame).toContain("Remote Mode");
|
||||
expect(frame).toContain("Ask anything");
|
||||
|
|
@ -34,7 +34,7 @@ describe("TUIChat - Remote Server Tests", () => {
|
|||
<AppRoot remoteUrl="http://localhost:3000" />
|
||||
);
|
||||
const frame = lastFrame();
|
||||
|
||||
|
||||
// Should show remote mode in the UI
|
||||
expect(frame).toContain("◉ Remote Mode");
|
||||
});
|
||||
|
|
@ -44,10 +44,10 @@ describe("TUIChat - Remote Server Tests", () => {
|
|||
<AppRoot remoteUrl="http://localhost:3000" />
|
||||
);
|
||||
const frame = lastFrame();
|
||||
|
||||
|
||||
// Should not show loading services message
|
||||
expect(frame).not.toContain("Loading services");
|
||||
|
||||
|
||||
// Should go directly to chat UI
|
||||
expect(frame).toContain("Ask anything");
|
||||
});
|
||||
|
|
@ -57,7 +57,7 @@ describe("TUIChat - Remote Server Tests", () => {
|
|||
<AppRoot remoteUrl="https://api.example.com:8080" />
|
||||
);
|
||||
const frame = lastFrame();
|
||||
|
||||
|
||||
// Should still work with different URLs
|
||||
expect(frame).toBeDefined();
|
||||
expect(frame).toContain("Remote Mode");
|
||||
|
|
@ -78,19 +78,19 @@ describe("TUIChat - Remote Server Tests", () => {
|
|||
await new Promise((resolve) => setTimeout(resolve, 200));
|
||||
|
||||
const frame = lastFrame();
|
||||
|
||||
|
||||
// Should show slash character at minimum
|
||||
expect(frame).toContain("/");
|
||||
|
||||
|
||||
// The slash command menu might show /exit or navigation instructions
|
||||
// Different timing might show different states
|
||||
const hasSlashCommandUI = frame ? (
|
||||
frame.includes("/exit") ||
|
||||
frame.includes("Use ↑/↓ to navigate") ||
|
||||
frame.includes("/exit") ||
|
||||
frame.includes("↑/↓ to navigate") ||
|
||||
frame.includes("◉ /") ||
|
||||
frame.includes("/ for slash commands") // Placeholder text is also valid
|
||||
) : false;
|
||||
|
||||
|
||||
expect(hasSlashCommandUI).toBe(true);
|
||||
});
|
||||
});
|
||||
|
|
@ -23,7 +23,7 @@ describe("TUIChat - Tool Display Tests", () => {
|
|||
<AppRoot remoteUrl="http://localhost:3000" />
|
||||
);
|
||||
const frame = lastFrame();
|
||||
|
||||
|
||||
expect(frame).toBeDefined();
|
||||
expect(frame).toContain("Ask anything");
|
||||
});
|
||||
|
|
@ -33,7 +33,7 @@ describe("TUIChat - Tool Display Tests", () => {
|
|||
<AppRoot remoteUrl="http://localhost:3000" />
|
||||
);
|
||||
const frame = lastFrame();
|
||||
|
||||
|
||||
// Should render normally even without tools
|
||||
expect(frame).toBeDefined();
|
||||
expect(frame).toContain("Remote Mode");
|
||||
|
|
@ -46,11 +46,11 @@ describe("TUIChat - Tool Display Tests", () => {
|
|||
|
||||
// Type a message that might trigger tool use
|
||||
stdin.write("Use a tool to help me");
|
||||
|
||||
|
||||
await new Promise((resolve) => setTimeout(resolve, 50));
|
||||
|
||||
|
||||
const frame = lastFrame();
|
||||
|
||||
|
||||
// UI should remain stable
|
||||
expect(frame).toBeDefined();
|
||||
if (frame) {
|
||||
|
|
@ -68,24 +68,24 @@ describe("TUIChat - Tool Display Tests", () => {
|
|||
|
||||
// Type / to see commands
|
||||
stdin.write("/");
|
||||
|
||||
|
||||
// Wait longer for slash command menu
|
||||
await new Promise((resolve) => setTimeout(resolve, 200));
|
||||
|
||||
|
||||
const frame = lastFrame();
|
||||
|
||||
|
||||
// Should show slash command character
|
||||
expect(frame).toContain("/");
|
||||
|
||||
|
||||
// The slash command menu might show different UI states
|
||||
// On Windows, the timing might be different
|
||||
const hasSlashCommandIndicator = frame ? (
|
||||
frame.includes("Use ↑/↓ to navigate") ||
|
||||
frame.includes("↑/↓ to navigate") ||
|
||||
frame.includes("/exit") ||
|
||||
frame.includes("◉ /") ||
|
||||
frame.includes("/ for slash commands")
|
||||
) : false;
|
||||
|
||||
|
||||
expect(hasSlashCommandIndicator).toBe(true);
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Reference in a new issue