55 lines
1.5 KiB
PHP
55 lines
1.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Tests\Feature\Api\V1\IncoSheets;
|
|
|
|
use Database\ArcadiaReplicate\Factories\Refp\IncoFactory;
|
|
use Database\Seeders\ArcadiaReplicateSeeder;
|
|
|
|
describe('IncoSheet Show Feature API', function (): void {
|
|
beforeEach(function (): void {
|
|
IncoFactory::truncate();
|
|
});
|
|
|
|
it('returns 200 OK with inco sheet details for valid inco sheet ID', function (): void {
|
|
// GIVEN
|
|
/** @var \Tests\TestCase $test */
|
|
$test = $this;
|
|
|
|
IncoFactory::new()->create([
|
|
'NO_ART' => 12345,
|
|
'DENOM_LEG' => 'Poulet Rôti 1kg Test',
|
|
]);
|
|
|
|
// WHEN
|
|
$response = $test->getJson('/api/v1/inco-sheets/12345');
|
|
|
|
// THEN
|
|
$response->assertStatus(200);
|
|
$response->assertJson([
|
|
'incoSheet' => [
|
|
'incoId' => '12345',
|
|
'label' => 'Poulet Rôti 1Kg Test',
|
|
],
|
|
]);
|
|
});
|
|
|
|
it('returns 200 OK with formatted sellFamilly for seeded inco sheet', function (): void {
|
|
// GIVEN
|
|
/** @var \Tests\TestCase $test */
|
|
$test = $this;
|
|
|
|
$seeder = new ArcadiaReplicateSeeder();
|
|
$seeder->run();
|
|
|
|
// WHEN
|
|
$response = $test->getJson('/api/v1/inco-sheets/47789');
|
|
|
|
// THEN
|
|
$response->assertStatus(200);
|
|
$response->assertJsonPath('incoSheet.incoId', '47789');
|
|
$response->assertJsonPath('incoSheet.sellFamilly', 'Panes du volailler <=400g');
|
|
$response->assertJsonPath('incoSheet.allergens', ['Gluten', 'Lait']);
|
|
});
|
|
});
|