|
117 | 117 |
|
118 | 118 | expect(Npm::packages())->toBe([]); |
119 | 119 | }); |
| 120 | + |
| 121 | +it('returns non-scoped package directories with boost guidelines', function (): void { |
| 122 | + file_put_contents(base_path('package.json'), json_encode([ |
| 123 | + 'dependencies' => [ |
| 124 | + 'laravel-echo' => '^2.0.0', |
| 125 | + 'axios' => '^1.0.0', |
| 126 | + ], |
| 127 | + ])); |
| 128 | + |
| 129 | + $withGuidelines = base_path(implode(DIRECTORY_SEPARATOR, [ |
| 130 | + 'node_modules', 'laravel-echo', 'resources', 'boost', 'guidelines', |
| 131 | + ])); |
| 132 | + File::ensureDirectoryExists($withGuidelines); |
| 133 | + |
| 134 | + $withoutGuidelines = base_path(implode(DIRECTORY_SEPARATOR, [ |
| 135 | + 'node_modules', 'axios', |
| 136 | + ])); |
| 137 | + File::ensureDirectoryExists($withoutGuidelines); |
| 138 | + |
| 139 | + $result = Npm::packagesDirectoriesWithBoostGuidelines(); |
| 140 | + |
| 141 | + expect($result) |
| 142 | + ->toHaveKey('laravel-echo') |
| 143 | + ->not->toHaveKey('axios'); |
| 144 | +}); |
| 145 | + |
| 146 | +it('returns non-scoped package directories with boost skills', function (): void { |
| 147 | + file_put_contents(base_path('package.json'), json_encode([ |
| 148 | + 'dependencies' => [ |
| 149 | + 'laravel-echo' => '^2.0.0', |
| 150 | + ], |
| 151 | + ])); |
| 152 | + |
| 153 | + $withSkills = base_path(implode(DIRECTORY_SEPARATOR, [ |
| 154 | + 'node_modules', 'laravel-echo', 'resources', 'boost', 'skills', |
| 155 | + ])); |
| 156 | + File::ensureDirectoryExists($withSkills); |
| 157 | + |
| 158 | + $result = Npm::packagesDirectoriesWithBoostSkills(); |
| 159 | + |
| 160 | + expect($result)->toHaveKey('laravel-echo'); |
| 161 | +}); |
| 162 | + |
| 163 | +it('identifies non-scoped first party packages', function (): void { |
| 164 | + expect(Npm::isFirstPartyPackage('laravel-echo'))->toBeTrue(); |
| 165 | +}); |
| 166 | + |
| 167 | +it('does not identify unknown packages as first party', function (): void { |
| 168 | + expect(Npm::isFirstPartyPackage('axios'))->toBeFalse() |
| 169 | + ->and(Npm::isFirstPartyPackage('lodash'))->toBeFalse() |
| 170 | + ->and(Npm::isFirstPartyPackage('unknown-package'))->toBeFalse(); |
| 171 | +}); |
0 commit comments