set('services.yookassa.shop_id', '1392092'); config()->set('services.yookassa.secret_key', 'test_secret'); config()->set('services.yookassa.api_url', 'https://api.yookassa.ru/v3'); }); it('зелёный при 200 от /me', function () { Http::fake(['api.yookassa.ru/v3/me' => Http::response(['account_id' => '1392092'], 200)]); $r = (new YooKassaLivenessProbe)->check(); expect($r->serviceKey)->toBe('yookassa'); expect($r->light)->toBe('green'); }); it('красный при 401', function () { Http::fake(['api.yookassa.ru/v3/me' => Http::response(['type' => 'error'], 401)]); expect((new YooKassaLivenessProbe)->check()->light)->toBe('red'); }); it('серый, когда ключи не заданы', function () { config()->set('services.yookassa.shop_id', ''); config()->set('services.yookassa.secret_key', ''); expect((new YooKassaLivenessProbe)->check()->light)->toBe('grey'); }); it('красный при сетевой ошибке (проба не бросает)', function () { Http::fake(fn () => throw new RuntimeException('network down')); expect((new YooKassaLivenessProbe)->check()->light)->toBe('red'); });