|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +namespace Tests\Unit\Install\CodeEnvironment; |
| 6 | + |
| 7 | +use Laravel\Boost\Install\CodeEnvironment\ClaudeCode; |
| 8 | +use Laravel\Boost\Install\Detection\DetectionStrategyFactory; |
| 9 | +use Laravel\Boost\Install\Enums\Platform; |
| 10 | +use Mockery; |
| 11 | + |
| 12 | +beforeEach(function (): void { |
| 13 | + $this->strategyFactory = Mockery::mock(DetectionStrategyFactory::class); |
| 14 | +}); |
| 15 | + |
| 16 | +test('systemDetectionConfig returns command-based detection for all platforms', function (): void { |
| 17 | + $claude = new ClaudeCode($this->strategyFactory); |
| 18 | + |
| 19 | + expect($claude->systemDetectionConfig(Platform::Darwin)) |
| 20 | + ->toHaveKey('command') |
| 21 | + ->and($claude->systemDetectionConfig(Platform::Linux)) |
| 22 | + ->toHaveKey('command') |
| 23 | + ->and($claude->systemDetectionConfig(Platform::Windows)) |
| 24 | + ->toHaveKey('command'); |
| 25 | +}); |
| 26 | + |
| 27 | +test('guidelinesPath returns default CLAUDE.md when no config set', function (): void { |
| 28 | + $claude = new ClaudeCode($this->strategyFactory); |
| 29 | + |
| 30 | + expect($claude->guidelinesPath())->toBe('CLAUDE.md'); |
| 31 | +}); |
| 32 | + |
| 33 | +test('guidelinesPath returns a custom path from config', function (): void { |
| 34 | + config(['boost.code_environments.claude_code.guidelines_path' => '.claude/CLAUDE.md']); |
| 35 | + |
| 36 | + $claude = new ClaudeCode($this->strategyFactory); |
| 37 | + |
| 38 | + expect($claude->guidelinesPath())->toBe('.claude/CLAUDE.md'); |
| 39 | +}); |
| 40 | + |
| 41 | +test('guidelinesPath returns a nested custom path from config', function (): void { |
| 42 | + config(['boost.code_environments.claude_code.guidelines_path' => 'docs/ai/CLAUDE.md']); |
| 43 | + |
| 44 | + $claude = new ClaudeCode($this->strategyFactory); |
| 45 | + |
| 46 | + expect($claude->guidelinesPath())->toBe('docs/ai/CLAUDE.md'); |
| 47 | +}); |
0 commit comments