- Introduced new endpoints for creating and modifying articles (`art_add`, `art_mod`) and tiers (`third_add`, `third_mod`), allowing users to manage these entities effectively. - Updated the Articles and Tiers pages to include forms for adding and modifying records, complete with parameter tables for clear guidance on required inputs. - Enhanced the API documentation to include detailed descriptions, examples, and metadata for the new endpoints, improving usability and understanding for developers. - Created a new rule for writing conventions with French accents to ensure consistency across the project. - Updated existing documentation to reflect structural changes and added a summary table for CRUD operations. - Added tests to verify the functionality of the new features and ensure robust error handling.
90 lines
2.8 KiB
PHP
90 lines
2.8 KiB
PHP
<?php
|
|
|
|
use App\Filament\Pages\Documentation;
|
|
use App\Models\User;
|
|
use Livewire\Livewire;
|
|
|
|
beforeEach(function () {
|
|
$this->actingAs(User::factory()->create());
|
|
});
|
|
|
|
it('renders the documentation page', function () {
|
|
Livewire::test(Documentation::class)
|
|
->assertSuccessful()
|
|
->assertSee('Documentation API Logistics');
|
|
});
|
|
|
|
it('converts markdown to HTML content', function () {
|
|
$component = Livewire::test(Documentation::class);
|
|
|
|
expect($component->get('htmlContent'))
|
|
->toBeString()
|
|
->not->toBeEmpty()
|
|
->toContain('<h1 id="')
|
|
->toContain('<table>');
|
|
});
|
|
|
|
it('generates heading IDs matching the table of contents anchors', function () {
|
|
$html = Livewire::test(Documentation::class)->get('htmlContent');
|
|
|
|
$anchors = [
|
|
'1-pré-requis',
|
|
'2-environnements-dutilisation',
|
|
'3-comment-effectuer-des-requêtes',
|
|
'4-structure-de-réponse',
|
|
'5-tables-et-colonnes-disponibles',
|
|
'6-récupération-de-données',
|
|
'7-envoi-de-données',
|
|
'8-relations-entre-entités',
|
|
'9-remarques-et-points-dattention',
|
|
'10-ressources-externes',
|
|
];
|
|
|
|
foreach ($anchors as $anchor) {
|
|
expect($html)->toContain("id=\"{$anchor}\"");
|
|
}
|
|
});
|
|
|
|
it('displays the main documentation sections', function () {
|
|
Livewire::test(Documentation::class)
|
|
->assertSee('Pré-requis')
|
|
->assertSee('Comment effectuer des requêtes')
|
|
->assertSee('Structure de réponse')
|
|
->assertSee('Tables et colonnes disponibles')
|
|
->assertSee('Récupération de données')
|
|
->assertSee('Envoi de données');
|
|
});
|
|
|
|
it('downloads the documentation as PDF', function () {
|
|
$response = $this->get(route('documentation.download-pdf'));
|
|
|
|
$response->assertSuccessful()
|
|
->assertHeader('content-type', 'application/pdf');
|
|
});
|
|
|
|
it('documents all service endpoints', function () {
|
|
Livewire::test(Documentation::class)
|
|
->assertSee('tables_list')
|
|
->assertSee('column_list')
|
|
->assertSee('art_list')
|
|
->assertSee('art_getstk')
|
|
->assertSee('jnl_list')
|
|
->assertSee('document_list')
|
|
->assertSee('document_detail')
|
|
->assertSee('document_add')
|
|
->assertSee('document_mod')
|
|
->assertSee('Document_GetStatusList')
|
|
->assertSee('Document_GetUnitPriceAndVat')
|
|
->assertSee('Document_GetDueDate')
|
|
->assertSee('Document_GetAttachListThumbnail')
|
|
->assertSee('third_list')
|
|
->assertSee('third_GetArtHistory')
|
|
->assertSee('getserialnumber')
|
|
->assertSee('codes_list')
|
|
->assertSee('custom_geninv_updatestock')
|
|
->assertSee('art_add')
|
|
->assertSee('art_mod')
|
|
->assertSee('third_add')
|
|
->assertSee('third_mod');
|
|
});
|