Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 10 additions & 24 deletions src/assets/__tests__/assets.snapshot.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,36 +87,22 @@ describe('Assets Directory Snapshots', () => {
});
});

describe('Static assets', () => {
describe.skipIf(assetFiles.filter(f => f.startsWith('static/')).length === 0)('Static assets', () => {
const staticFiles = assetFiles.filter(f => f.startsWith('static/'));

if (staticFiles.length > 0) {
it.each(staticFiles)('static/%s should match snapshot', file => {
const content = readFileContent(path.join(ASSETS_DIR, file));
expect(content).toMatchSnapshot();
});
} else {
it('static directory is empty or does not exist', () => {
// Static assets may not exist
expect(true).toBe(true);
});
}
it.each(staticFiles)('static/%s should match snapshot', file => {
const content = readFileContent(path.join(ASSETS_DIR, file));
expect(content).toMatchSnapshot();
});
});

describe('TypeScript assets', () => {
describe.skipIf(assetFiles.filter(f => f.startsWith('typescript/')).length === 0)('TypeScript assets', () => {
const tsFiles = assetFiles.filter(f => f.startsWith('typescript/'));

if (tsFiles.length > 0) {
it.each(tsFiles)('typescript/%s should match snapshot', file => {
const content = readFileContent(path.join(ASSETS_DIR, file));
expect(content).toMatchSnapshot();
});
} else {
it('typescript directory is empty or contains only placeholder files', () => {
// TypeScript assets may not exist yet
expect(true).toBe(true);
});
}
it.each(tsFiles)('typescript/%s should match snapshot', file => {
const content = readFileContent(path.join(ASSETS_DIR, file));
expect(content).toMatchSnapshot();
});
});

describe('Root-level assets', () => {
Expand Down
89 changes: 0 additions & 89 deletions src/cli/tui/components/__tests__/ConfirmReview.test.tsx

This file was deleted.

40 changes: 0 additions & 40 deletions src/cli/tui/components/__tests__/Cursor.test.tsx

This file was deleted.

45 changes: 0 additions & 45 deletions src/cli/tui/components/__tests__/FatalError.test.tsx

This file was deleted.

34 changes: 0 additions & 34 deletions src/cli/tui/components/__tests__/Header.test.tsx

This file was deleted.

20 changes: 0 additions & 20 deletions src/cli/tui/components/__tests__/HelpText.test.tsx

This file was deleted.

30 changes: 0 additions & 30 deletions src/cli/tui/components/__tests__/LogLink.test.tsx

This file was deleted.

56 changes: 2 additions & 54 deletions src/cli/tui/components/__tests__/Panel.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,57 +25,20 @@ describe('Panel', () => {
);
const frame = lastFrame()!;
expect(frame).toContain('Panel body');
// Verify border structure: top-left corner on first line, bottom-right on last
const lines = frame.split('\n');
expect(lines[0]).toContain('╭');
expect(lines[lines.length - 1]).toContain('╯');
});

it('renders title as first line inside border when provided', () => {
it('renders title before body content', () => {
const { lastFrame } = render(
<Panel title="Settings">
<Text>body</Text>
</Panel>
);
const frame = lastFrame()!;
expect(frame).toContain('Settings');
expect(frame).toContain('body');
// Title should appear before body in the output
const titleIdx = frame.indexOf('Settings');
const bodyIdx = frame.indexOf('body');
expect(titleIdx).toBeLessThan(bodyIdx);
});

it('does not include title text when title is omitted', () => {
const { lastFrame } = render(
<Panel>
<Text>body only</Text>
</Panel>
);
const frame = lastFrame()!;
expect(frame).toContain('body only');
// The frame should only have border + body, no extra text before body
const lines = frame.split('\n').filter(l => l.trim().length > 0);
// First meaningful content line after the top border should be the body
expect(lines.length).toBeGreaterThanOrEqual(3); // top border, body, bottom border
});

it('renders with fullWidth when fullWidth prop is true', () => {
// With fullWidth=false (default), Panel uses contentWidth from context
// With fullWidth=true, Panel uses 100%
const { lastFrame: narrowFrame } = render(
<Panel>
<Text>narrow</Text>
</Panel>
);
const { lastFrame: wideFrame } = render(
<Panel fullWidth>
<Text>wide</Text>
</Panel>
);
// Both should render their content
expect(narrowFrame()).toContain('narrow');
expect(wideFrame()).toContain('wide');
expect(frame.indexOf('Settings')).toBeLessThan(frame.indexOf('body'));
});

it('adapts to different content widths from context', () => {
Expand All @@ -93,23 +56,8 @@ describe('Panel', () => {
</Panel>
);

// Both render successfully — the narrow panel's top border should be shorter
const narrowTopLine = narrow()!.split('\n')[0]!;
const wideTopLine = wide()!.split('\n')[0]!;
expect(narrowTopLine.length).toBeLessThan(wideTopLine.length);
});

it('renders with borderColor prop without breaking layout', () => {
const { lastFrame } = render(
<Panel borderColor="green">
<Text>colored border</Text>
</Panel>
);
const frame = lastFrame()!;
expect(frame).toContain('colored border');
// Border structure should still be intact
const lines = frame.split('\n');
expect(lines[0]).toContain('╭');
expect(lines[lines.length - 1]).toContain('╯');
});
});
Loading
Loading