<?php

use Illuminate\Support\Facades\Config;
use function Pest\Laravel\getJson;

test('confirm config loaded', function () {
    expect(config('laravel-monitoring'))
        ->toBe([
            'packages' => [
                'laravel/framework',
                'laravel/nova',
            ],
            'composer' => [
                'bin' => 'composer',
                'home' => null,
            ]
        ]);
});

test('expect exception when malformed config', function () {
    Config::set('laravel-monitoring.packages');
    $response = getJson('/api/tricks/monitoring');

    if (version_compare(app()->version(), '10.9.0', '>=')) {
        $response->assertInternalServerError();
    } else {
        $response->assertStatus(500);
    }
});