improve 4 test

This commit is contained in:
2025-05-11 11:10:40 +03:30
parent 0a2b324041
commit f2fda29041
4 changed files with 196 additions and 197 deletions

View File

@@ -2,14 +2,13 @@
namespace Tests\Feature\Call;
use App\Models\Call;
use App\Models\CallHistory;
use App\Models\Event;
use App\Models\User;
use App\Enums\CallEvents;
use App\Services\Notification\NotificationService;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Illuminate\Support\Facades\DB;
use Mockery\MockInterface;
use Tests\TestCase;
@@ -36,7 +35,7 @@ class StoreTest extends TestCase
$response = $this->actingAs($user)->postJson(route('calls.store'), [
'extension' => $this->faker->numberBetween(1000, 9999),
'caller_id' => $this->faker->numerify('09#########'),
'caller_id' => $this->faker->randomNumber(),
]);
$response->assertUnprocessable()
@@ -50,8 +49,8 @@ class StoreTest extends TestCase
$user = User::factory()->create();
$response = $this->actingAs($user)->postJson(route('calls.store'), [
'extension' => 'invalid-ext-' . $this->faker->uuid,
'caller_id' => $this->faker->numerify('09#########'),
'extension' => $this->faker->uuid,
'caller_id' => $this->faker->randomNumber(),
]);
$response->assertUnprocessable()
@@ -77,10 +76,11 @@ class StoreTest extends TestCase
public function test_can_create_a_call(): void
{
$operator = User::factory()->make(); // bypass fillable
$operator = User::factory()->create();
$operator->telephone_id = 'tel-' . $this->faker->unique()->numerify('###');
$operator->save();
DB::table('events')->truncate();
$this->artisan('db:seed --class=EventSeeder');
$this->mock(NotificationService::class, function (MockInterface $mock) {