@letanure/resend-cli
Version:
A command-line interface for Resend email API
62 lines • 3.64 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Text } from 'ink';
import { describe, expect, it } from 'vitest';
import { renderWithProviders } from '../../utils/test-utils.js';
import { Layout } from './layout.js';
describe('Layout Component', () => {
it('renders header text', () => {
const { lastFrame } = renderWithProviders(_jsx(Layout, { headerText: "Test Header", children: _jsx(Text, { children: "Content" }) }));
const output = lastFrame();
expect(output).toContain('Test Header');
expect(output).toContain('Content');
});
it('renders footer text', () => {
const { lastFrame } = renderWithProviders(_jsx(Layout, { headerText: "Header", footerText: "Footer instructions", children: _jsx(Text, { children: "Content" }) }));
const output = lastFrame();
expect(output).toContain('Footer instructions');
});
it('shows navigation instructions when enabled', () => {
const { lastFrame } = renderWithProviders(_jsx(Layout, { headerText: "Header", showNavigationInstructions: true, children: _jsx(Text, { children: "Content" }) }));
const output = lastFrame();
expect(output).toContain('↑/↓');
expect(output).toContain('Enter');
expect(output).toContain('ESC');
});
it('hides navigation instructions when disabled', () => {
const { lastFrame } = renderWithProviders(_jsx(Layout, { headerText: "Header", showNavigationInstructions: false, children: _jsx(Text, { children: "Content" }) }));
const output = lastFrame();
expect(output).not.toContain('↑/↓');
});
it('shows dry-run banner in dry-run mode', () => {
const { lastFrame } = renderWithProviders(_jsx(Layout, { headerText: "Header", children: _jsx(Text, { children: "Content" }) }), { isDryRun: true });
const output = lastFrame();
expect(output).toContain('DRY RUN MODE');
expect(output).toContain('Operations will be validated but not executed');
});
it('hides dry-run banner in normal mode', () => {
const { lastFrame } = renderWithProviders(_jsx(Layout, { headerText: "Header", children: _jsx(Text, { children: "Content" }) }), { isDryRun: false });
const output = lastFrame();
expect(output).not.toContain('DRY RUN MODE');
});
it('renders children content', () => {
const { lastFrame } = renderWithProviders(_jsxs(Layout, { headerText: "Header", children: [_jsx(Text, { children: "Custom child content" }), _jsx(Text, { children: "Second child" })] }));
const output = lastFrame();
expect(output).toContain('Custom child content');
expect(output).toContain('Second child');
});
it('renders without optional props', () => {
const { lastFrame } = renderWithProviders(_jsx(Layout, { children: _jsx(Text, { children: "Just content" }) }));
const output = lastFrame();
expect(output).toContain('Just content');
});
it('renders with all props combined', () => {
const { lastFrame } = renderWithProviders(_jsx(Layout, { headerText: "Full Test Header", footerText: "Full footer text", showNavigationInstructions: true, children: _jsx(Text, { children: "All props content" }) }), { isDryRun: true });
const output = lastFrame();
expect(output).toContain('Full Test Header');
expect(output).toContain('Full footer text');
expect(output).toContain('↑/↓');
expect(output).toContain('DRY RUN MODE');
expect(output).toContain('All props content');
});
});
//# sourceMappingURL=layout.test.js.map