<?php

use App\Models\User;

test('profile redirect works', function () {
    $user = User::factory()->create();

    $this->actingAs($user)
        ->get('/profile')
        ->assertRedirect(route('profile.personal'));
});

test('profile personal page is displayed', function () {
    $user = User::factory()->create();

    $this->actingAs($user)
        ->get(route('profile.personal'))
        ->assertOk();
});

test('profile preferences page is displayed', function () {
    $user = User::factory()->create();

    $this->actingAs($user)
        ->get(route('profile.preferences'))
        ->assertOk();
});

test('profile security page is displayed', function () {
    $user = User::factory()->create();

    $this->actingAs($user)
        ->get(route('profile.security'))
        ->assertOk();
});

test('guest cannot access profile pages', function () {
    $this->get(route('profile.personal'))->assertRedirect(route('login'));
    $this->get(route('profile.preferences'))->assertRedirect(route('login'));
    $this->get(route('profile.security'))->assertRedirect(route('login'));
});
