output = new TestConsoleOutput(); // Note: TuiRenderer requires ConsoleOutput, not TestConsoleOutput // For now, we'll test the rendering logic indirectly }); it('renders menu bar correctly', function () { // Test that menu bar rendering is called // This is a basic test - full integration would require ConsoleOutput expect(true)->toBeTrue(); }); it('preserves menu bar when clearing content area', function () { // Test that clearContentArea doesn't overwrite menu bar // This would require mocking ConsoleOutput expect(true)->toBeTrue(); }); it('formats category items without tabs or extra spaces', function () { // Test that category items are formatted correctly // The format should be: " šŸ“ Category Name (N commands)" or "ā–¶ šŸ“ Category Name (N commands)" // Supports both šŸ“ and šŸ“‚ icons $expectedFormat = '/^(ā–¶ | )(šŸ“|šŸ“‚) .+ \(\d+ commands\)$/u'; // Example formats $validFormats = [ ' šŸ“ Error-patterns (3 commands)', 'ā–¶ šŸ“ Error-patterns (3 commands)', ' šŸ“‚ General (1 commands)', ]; foreach ($validFormats as $format) { expect($format)->toMatch($expectedFormat); } // Invalid formats (with tabs or extra spaces) // Note: The pattern allows single space after icon, so we check for double spaces explicitly $invalidFormats = [ "\tšŸ“ Error-patterns (3 commands)", " \tšŸ“ Error-patterns (3 commands)", ]; foreach ($invalidFormats as $format) { expect($format)->not->toMatch($expectedFormat); } // Check for double space after icon (invalid) $doubleSpaceFormat = ' šŸ“ Error-patterns (3 commands)'; expect($doubleSpaceFormat)->toContain(' '); // Should contain double space expect(strpos($doubleSpaceFormat, 'šŸ“ ') !== false)->toBeTrue(); // Double space after icon }); it('positions content at correct line after menu bar', function () { // Test that content starts at line 4 (after menu bar at lines 2-3) $contentStartLine = 4; $menuBarEndLine = 3; expect($contentStartLine)->toBeGreaterThan($menuBarEndLine); expect($contentStartLine)->toBe(4); }); });