update tests
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Api\V1;
|
||||
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\Concerns\CreatesApiTestUsers;
|
||||
use Tests\TestCase;
|
||||
|
||||
class ScannerControllerTest extends TestCase
|
||||
{
|
||||
use CreatesApiTestUsers;
|
||||
use RefreshDatabase;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$this->seedApiTestConfig();
|
||||
}
|
||||
|
||||
public function test_process_requires_a_badge_code(): void
|
||||
{
|
||||
$this->postJson('/api/v1/scanner/process', ['badgeCode' => ''])
|
||||
->assertStatus(400)
|
||||
->assertJsonPath('status', false)
|
||||
->assertJsonPath('ok', false);
|
||||
}
|
||||
|
||||
public function test_process_returns_404_for_unknown_badge(): void
|
||||
{
|
||||
$this->postJson('/api/v1/scanner/process', ['badgeCode' => 'NO-SUCH-BADGE'])
|
||||
->assertNotFound()
|
||||
->assertJsonPath('status', false)
|
||||
->assertJsonPath('ok', false);
|
||||
}
|
||||
|
||||
public function test_process_accepts_alternative_badge_field_names(): void
|
||||
{
|
||||
$this->postJson('/api/v1/scanner/process', ['barcode' => 'STILL-UNKNOWN'])
|
||||
->assertNotFound()
|
||||
->assertJsonPath('status', false);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user