mirror of
https://github.com/AnimeThemes/animethemes-server.git
synced 2026-07-24 15:54:28 +02:00
48 lines
801 B
PHP
48 lines
801 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Models\Auth\User;
|
|
|
|
use function Pest\Laravel\actingAs;
|
|
|
|
test('unauthenticated returns null', function () {
|
|
$response = $this->graphQL('
|
|
query {
|
|
me {
|
|
id
|
|
}
|
|
}
|
|
', );
|
|
|
|
$response->assertOk();
|
|
$response->assertJson([
|
|
'data' => [
|
|
'me' => null,
|
|
],
|
|
]);
|
|
});
|
|
|
|
test('authenticated returns user', function () {
|
|
$user = User::factory()->createOne();
|
|
|
|
actingAs($user);
|
|
|
|
$response = $this->graphQL('
|
|
query {
|
|
me {
|
|
id
|
|
}
|
|
}
|
|
');
|
|
|
|
$response->assertOk();
|
|
$response->assertJson([
|
|
'data' => [
|
|
'me' => [
|
|
'id' => $user->getKey(),
|
|
],
|
|
],
|
|
]);
|
|
});
|