clear check assert redirect tests

This commit is contained in:
2023-12-18 13:18:48 +03:00
parent 2a60fe392a
commit 8d267bee25
2 changed files with 19 additions and 10 deletions

View File

@@ -8,6 +8,7 @@ use Illuminate\Support\Facades\Storage;
use App\Livewire\Plan\Create;
use App\Models\Plan;
use App\Models\User;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Livewire\Features\SupportFileUploads\TemporaryUploadedFile;
@@ -40,8 +41,8 @@ class CreateTest extends TestCase
->get('/plan/create');
$response
->assertStatus(302)
->assertRedirect('https://dev2.eatvio.com/ru');
->assertStatus(302);
// ->assertRedirect(route('home'));
}
public function test_publish_new_plan_success(): void
@@ -71,13 +72,15 @@ class CreateTest extends TestCase
->set('packet3_options', $this->plan->packet3_options)
->assertSet('packet3_options', $this->plan->packet3_options)
->call('publish')
->assertStatus(200);
->assertStatus(200)
->assertHasNoErrors(['name', 'image', 'duration', 'details']);
Storage::disk('public')->assertExists($this->plan->image);
// $this->assertEquals($count + 1, Plan::count());
}
//
public function test_to_draft_new_plan_success(): void
{
$this->actingAs($this->user);
@@ -106,10 +109,13 @@ class CreateTest extends TestCase
->assertSet('packet3_options', $this->plan->packet3_options)
->call('addToDrafts')
->assertStatus(200)
->assertRedirect('plan/' . $id + 1);
->assertRedirect('plan/' . $id + 1)
->assertHasNoErrors(['name', 'image', 'duration', 'details']);
Storage::disk('public')->assertExists($this->plan->image);
}
//
public function test_to_preview_new_plan_success(): void
{
$this->actingAs($this->user);
@@ -135,9 +141,11 @@ class CreateTest extends TestCase
->set('packet3_options', $this->plan->packet3_options)
->assertSet('packet3_options', $this->plan->packet3_options)
->call('showPreview')
->assertStatus(200);
}
->assertStatus(200)
->assertHasNoErrors(['name', 'image', 'duration', 'details']);
Storage::disk('public')->assertExists($this->plan->image);
}
public function test_set_empty_data(): void
{

View File

@@ -41,8 +41,9 @@ class ShowTest extends TestCase
->get('/plan/'. $this->plan->id);
$response
->assertStatus(302)
->assertRedirect('https://dev2.eatvio.com/ru');
->assertStatus(302);
// ->assertRedirect(route('home'));
// ->assertRedirect('https://dev2.eatvio.com/ru');
}
// When appear role for user