toBe(5_242_880); }); it('exposes binary and too-large placeholder constants', function () { expect(LocalFileVolume::BINARY_PLACEHOLDER)->toBe('[binary file]'); expect(LocalFileVolume::TOO_LARGE_PLACEHOLDER)->toBe('[file too large to display]'); }); it('flags is_too_large when content matches the placeholder', function () { $volume = new LocalFileVolume; $volume->content = LocalFileVolume::TOO_LARGE_PLACEHOLDER; expect($volume->is_too_large)->toBeTrue(); expect($volume->is_binary)->toBeFalse(); }); it('flags is_binary when content matches the placeholder', function () { $volume = new LocalFileVolume; $volume->content = LocalFileVolume::BINARY_PLACEHOLDER; expect($volume->is_binary)->toBeTrue(); expect($volume->is_too_large)->toBeFalse(); }); it('does not flag normal content as binary or too large', function () { $volume = new LocalFileVolume; $volume->content = "hello\nworld\n"; expect($volume->is_binary)->toBeFalse(); expect($volume->is_too_large)->toBeFalse(); }); it('does not flag empty content as binary or too large', function () { $volume = new LocalFileVolume; $volume->content = null; expect($volume->is_binary)->toBeFalse(); expect($volume->is_too_large)->toBeFalse(); }); it('exposes the too-large flag via toArray for Livewire serialization', function () { $volume = new LocalFileVolume; $volume->content = LocalFileVolume::TOO_LARGE_PLACEHOLDER; $array = $volume->toArray(); expect($array)->toHaveKey('is_too_large'); expect($array['is_too_large'])->toBeTrue(); }); it('does not read regular bind-mounted file contents while loading service settings', function () { $helpers = file_get_contents(base_path('bootstrap/helpers/services.php')); $filesystemSync = str($helpers) ->after('function getFilesystemVolumesFromServer') ->before('function updateCompose'); expect($filesystemSync->value()) ->not->toContain('instant_remote_process(["cat $fileLocation"]'); expect($filesystemSync->value()) ->toContain('if ($fileVolume->is_based_on_git)') ->toContain('$fileVolume->loadStorageOnServer();'); });