<?php

use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;

uses(RefreshDatabase::class);

it('injects uploads v2 flag as false when disabled', function () {
    config(['features.uploads_v2' => false]);

    $user = User::factory()->create();

    $response = $this->actingAs($user)->get('/upload');

    $response->assertOk();
    $response->assertSee('window.SKINBASE_FLAGS', false);
    $response->assertSee('uploads_v2: false', false);
});

it('injects uploads v2 flag as true when enabled', function () {
    config(['features.uploads_v2' => true]);

    $user = User::factory()->create();

    $response = $this->actingAs($user)->get('/upload');

    $response->assertOk();
    $response->assertSee('window.SKINBASE_FLAGS', false);
    $response->assertSee('uploads_v2: true', false);
});
