mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-27 02:30:39 +00:00
added it_get_user_data test
This commit is contained in:
@@ -79,10 +79,90 @@ class UserAccountTest extends TestCase
|
||||
->image('fake-image.jpg');
|
||||
|
||||
$this->patchJson('/api/user/relationships/settings', [
|
||||
'avatar' => $avatar,
|
||||
'avatar' => $avatar,
|
||||
])->assertStatus(204);
|
||||
|
||||
Storage::disk('local')
|
||||
->assertExists($user->settings->avatar);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_get_user_data()
|
||||
{
|
||||
$user = User::factory(User::class)
|
||||
->create();
|
||||
|
||||
Sanctum::actingAs($user);
|
||||
|
||||
$this->getJson('/api/user')
|
||||
->assertStatus(200)
|
||||
->assertExactJson([
|
||||
"data" => [
|
||||
"id" => (string) $user->id,
|
||||
"type" => "user",
|
||||
"attributes" => [
|
||||
"storage_capacity" => "5",
|
||||
"subscription" => false,
|
||||
"incomplete_payment" => null,
|
||||
"stripe_customer" => false,
|
||||
"email" => $user->email,
|
||||
"role" => $user->role,
|
||||
"created_at_formatted" => format_date($user->created_at, '%d. %B. %Y'),
|
||||
"created_at" => $user->created_at->toJson(),
|
||||
"updated_at" => $user->updated_at->toJson(),
|
||||
]
|
||||
],
|
||||
"relationships" => [
|
||||
"settings" => [
|
||||
"data" => [
|
||||
"id" => (string) $user->id,
|
||||
"type" => "settings",
|
||||
"attributes" => [
|
||||
'avatar' => $user->settings->avatar,
|
||||
'billing_name' => $user->settings->name,
|
||||
'billing_address' => $user->settings->address,
|
||||
'billing_state' => $user->settings->state,
|
||||
'billing_city' => $user->settings->city,
|
||||
'billing_postal_code' => $user->settings->postal_code,
|
||||
'billing_country' => $user->settings->country,
|
||||
'billing_phone_number' => $user->settings->phone_number,
|
||||
'timezone' => $user->settings->timezone
|
||||
]
|
||||
]
|
||||
],
|
||||
"storage" => [
|
||||
"data" => [
|
||||
"id" => "1",
|
||||
"type" => "storage",
|
||||
"attributes" => [
|
||||
"used" => 0,
|
||||
"used_formatted" => "0.00%",
|
||||
"capacity" => "5",
|
||||
"capacity_formatted" => "5GB",
|
||||
]
|
||||
]
|
||||
],
|
||||
"favourites" => [
|
||||
"data" => [
|
||||
"id" => "1",
|
||||
"type" => "folders_favourite",
|
||||
"attributes" => [
|
||||
"folders" => []
|
||||
]
|
||||
]
|
||||
],
|
||||
"tree" => [
|
||||
"data" => [
|
||||
"id" => "1",
|
||||
"type" => "folders_tree",
|
||||
"attributes" => [
|
||||
"folders" => [],
|
||||
]
|
||||
]
|
||||
],
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user