- admin registration fixes

- alert popup refactoring
This commit is contained in:
Čarodej
2022-03-17 12:31:09 +01:00
parent e8f59ef0a9
commit 01588fa06b
41 changed files with 288 additions and 300 deletions

View File

@@ -1,4 +1,5 @@
<?php
namespace Tests\App\Users;
use Storage;
@@ -38,6 +39,7 @@ class SignFlowTest extends TestCase
});
$this->postJson('api/register', [
'role' => 'admin',
'email' => 'john@doe.com',
'password' => 'SecretPassword',
'password_confirmation' => 'SecretPassword',
@@ -48,6 +50,7 @@ class SignFlowTest extends TestCase
->assertDatabaseHas('users', [
'email' => 'john@doe.com',
'email_verified_at' => null,
'role' => 'user',
])
->assertDatabaseHas('user_settings', [
'first_name' => 'John',
@@ -99,6 +102,7 @@ class SignFlowTest extends TestCase
]);
$this->postJson('api/register', [
'role' => 'admin',
'email' => 'john@doe.com',
'password' => 'SecretPassword',
'password_confirmation' => 'SecretPassword',
@@ -108,6 +112,7 @@ class SignFlowTest extends TestCase
$this
->assertDatabaseCount('transactions', 0)
->assertDatabaseHas('users', [
'role' => 'user',
'email' => 'john@doe.com',
])
->assertDatabaseHas('subscriptions', [
@@ -162,6 +167,7 @@ class SignFlowTest extends TestCase
]);
$this->postJson('api/register', [
'role' => 'admin',
'email' => 'john@doe.com',
'password' => 'SecretPassword',
'password_confirmation' => 'SecretPassword',
@@ -172,6 +178,7 @@ class SignFlowTest extends TestCase
$this
->assertDatabaseHas('users', [
'role' => 'user',
'email' => 'john@doe.com',
])
->assertDatabaseHas('subscriptions', [
@@ -206,7 +213,7 @@ class SignFlowTest extends TestCase
public function it_try_register_when_registration_is_disabled()
{
Setting::updateOrCreate([
'name' => 'registration',
'name' => 'registration',
], [
'value' => 0,
]);
@@ -333,6 +340,7 @@ class SignFlowTest extends TestCase
'email' => $user->email,
]);
}
/**
* @test
*/
@@ -358,7 +366,7 @@ class SignFlowTest extends TestCase
$this
->assertDatabaseHas('users', [
'email' => 'john@doe.com',
'email' => 'john@doe.com',
]);
}
}

View File

@@ -121,46 +121,10 @@ class AdminTest extends TestCase
->actingAs($admin)
->getJson("/api/admin/users/$user->id/storage")
->assertStatus(200)
->assertExactJson([
'data' => [
'id' => $user->id,
'type' => 'storage',
'attributes' => [
'used' => '5.00MB',
'capacity' => '1GB',
'percentage' => 0.5,
],
'meta' => [
'images' => [
'used' => '1.00MB',
'percentage' => 0.1,
],
'audios' => [
'used' => '1.00MB',
'percentage' => 0.1,
],
'videos' => [
'used' => '1.00MB',
'percentage' => 0.1,
],
'documents' => [
'used' => '1.00MB',
'percentage' => 0.1,
],
'others' => [
'used' => '1.00MB',
'percentage' => 0.1,
],
'traffic' => [
'chart' => [
'download' => [],
'upload' => [],
],
'download' => '0B',
'upload' => '0B',
],
],
],
->assertJsonFragment([
'used' => '5.00MB',
'capacity' => '1GB',
'percentage' => 0.5,
]);
}

View File

@@ -23,28 +23,18 @@ class DashboardTest extends TestCase
->actingAs($user)
->getJson('/api/admin/dashboard')
->assertStatus(200)
->assertExactJson([
->assertJsonFragment([
'app' => [
'earnings' => '$0.00',
'isRunningCron' => false,
'license' => 'extended',
'version' => config('vuefilemanager.version'),
],
'disk' => [
'download' => [
'records' => [],
'total' => '0B',
],
'upload' => [
'records' => [],
'total' => '0B',
],
'used' => '2.00MB',
],
'users' => [
'total' => 1,
'usersPremiumTotal' => 0,
],
'used' => '2.00MB',
]);
}

View File

@@ -103,7 +103,7 @@ class HomepageTest extends TestCase
->get("/api/og-site/$share->token")
->assertStatus(200)
->assertSee('Fake Image')
->assertSee('md-fake-image.jpg');
->assertSee('lg-fake-image.jpg');
}
/**

View File

@@ -72,7 +72,9 @@ class SetupWizardTest extends TestCase
'storageLimitation' => 1,
'defaultStorage' => 10,
'logo' => UploadedFile::fake()->image('fake-logo.jpg'),
'logo_dark' => UploadedFile::fake()->image('fake-logo-dark.jpg'),
'logo_horizontal' => UploadedFile::fake()->image('fake-logo-horizontal.jpg'),
'logo_horizontal_dark' => UploadedFile::fake()->image('fake-logo-horizontal-dark.jpg'),
'favicon' => UploadedFile::fake()->image('fake-favicon.jpg'),
])->assertStatus(204);
@@ -168,7 +170,7 @@ class SetupWizardTest extends TestCase
$this->assertDatabaseHas('settings', [
'name' => 'license',
'value' => 'Regular',
'value' => 'regular',
]);
$this->assertDatabaseHas('settings', [