diff --git a/tests/Feature/InstallBrowserCommandTest.php b/tests/Feature/InstallBrowserCommandTest.php index 8dab1cf..1b4f1f1 100644 --- a/tests/Feature/InstallBrowserCommandTest.php +++ b/tests/Feature/InstallBrowserCommandTest.php @@ -1,29 +1,54 @@ shouldReceive('getVersion') + ->andReturn('200.0.0.0'); + + $downloadable->shouldReceive('getChromeBrowserURL') + ->andReturn('https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/200.0.0.0/linux64/chrome-linux64.zip'); + + $google->shouldReceive('getLatestVersion') + ->andReturn($downloadable); + artisan('install:browser --latest') - ->expectsOutputToContain('Downloading Google Chrome Browser') - ->expectsOutputToContain('downloaded') + ->doesntExpectOutputToContain("There' no versions available for [200.0.0.0]") + ->expectsOutputToContain('Downloading Google Chrome Browser [200.0.0.0]') + ->expectsOutputToContain('Google Chrome Browser [200.0.0.0] downloaded') ->assertSuccessful(); +}); - $finder = new Finder; +it('it download the browser version [113.0.5672.0]', function () { + Http::fake(); - $finder - ->directories() - ->in(join_paths(env('HOME'), '.google-for-testing')) - ->name('chrome*'); + $google = GoogleForTesting::partialMock(); + $downloadable = Mockery::mock(GoogleDownloadable::class); - expect($finder->hasResults()) - ->toBeTrue(); -}); + $downloadable->shouldReceive('getVersion') + ->andReturn('113.0.5672.0'); -it('it download the browser version []', function () { + $downloadable->shouldReceive('getChromeBrowserURL') + ->andReturn('https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/113.0.5672.0/linux64/chrome-linux64.zip'); -})->todo(); + $google->shouldReceive('getVersion') + ->andReturn($downloadable); + + artisan('install:browser --ver=113.0.5672.0') + ->doesntExpectOutputToContain("There' no versions available for [113.0.5672.0]") + ->expectsOutputToContain('Downloading Google Chrome Browser [113.0.5672.0]') + ->expectsOutputToContain('Google Chrome Browser [113.0.5672.0] downloaded') + ->assertSuccessful(); +}); it('download the browser on other path', function () {