mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-18 16:22:14 +00:00
added it_check_if_user_exist_and_return_name_with_avatar, it_check_non_existed_user_and_return_not_found test
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Tests\Feature\Accounts;
|
||||
|
||||
use App\Models\Setting;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
@@ -38,6 +39,22 @@ class AuthTest extends TestCase
|
||||
*/
|
||||
public function it_register_user()
|
||||
{
|
||||
collect([
|
||||
[
|
||||
'name' => 'storage_default',
|
||||
'value' => 12,
|
||||
],
|
||||
[
|
||||
'name' => 'registration',
|
||||
'value' => 1,
|
||||
],
|
||||
])->each(function ($setting) {
|
||||
Setting::create([
|
||||
'name' => $setting['name'],
|
||||
'value' => $setting['value'],
|
||||
]);
|
||||
});
|
||||
|
||||
$this->postJson('/register', [
|
||||
'email' => 'john@doe.com',
|
||||
'password' => 'SecretPassword',
|
||||
@@ -46,17 +63,41 @@ class AuthTest extends TestCase
|
||||
])->assertStatus(201);
|
||||
|
||||
$this->assertDatabaseHas('users', [
|
||||
'email' => 'john@doe.com',
|
||||
'email' => 'john@doe.com',
|
||||
]);
|
||||
|
||||
$this->assertDatabaseHas('user_settings', [
|
||||
'name' => 'John Doe',
|
||||
'name' => 'John Doe',
|
||||
'storage_capacity' => 12,
|
||||
]);
|
||||
|
||||
Storage::disk('local')
|
||||
->assertExists('files/' . User::first()->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_check_if_user_exist_and_return_name_with_avatar()
|
||||
{
|
||||
$user = User::factory(User::class)
|
||||
->create(['email' => 'john@doe.com']);
|
||||
|
||||
$this->postJson('/api/user/check', [
|
||||
'email' => $user->email,
|
||||
])->assertStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_check_non_existed_user_and_return_not_found()
|
||||
{
|
||||
$this->postJson('/api/user/check', [
|
||||
'email' => 'jane@doe.com',
|
||||
])->assertStatus(404);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user