m
This commit is contained in:
@@ -19,6 +19,7 @@ class SendThankCardTest extends TestCase
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
\Illuminate\Support\Facades\Http::fake();
|
||||
$this->userService = $this->app->make(UserServiceInterface::class);
|
||||
|
||||
// Create sender and receiver
|
||||
@@ -92,4 +93,27 @@ class SendThankCardTest extends TestCase
|
||||
$this->sender->refresh();
|
||||
$this->assertEquals(8, $this->sender->card);
|
||||
}
|
||||
|
||||
public function test_controller_validation_fails_returns_correct_json_format(): void
|
||||
{
|
||||
$this->actingAs($this->sender);
|
||||
|
||||
$response = $this->postJson(route('user.store_send'), [
|
||||
'receiver' => '',
|
||||
'amount' => 999,
|
||||
]);
|
||||
|
||||
$response->assertStatus(422);
|
||||
$response->assertJson([
|
||||
'success' => false,
|
||||
]);
|
||||
$response->assertJsonStructure([
|
||||
'success',
|
||||
'errors' => [
|
||||
'receiver',
|
||||
'amount',
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user