feat: translation codes
CI / 🧪 Tests Laravel (push) Successful in 2m34s
CI / 🐳 Build & Push Images (push) Successful in 2m26s

This commit is contained in:
2026-08-14 12:46:29 +02:00
parent 69372a49ed
commit 8b60283eeb
28 changed files with 59 additions and 62 deletions
+5 -5
View File
@@ -23,7 +23,7 @@ it('creates a report and a moderation case for a meal post', function () {
'details' => 'Même image publiée en boucle.',
])
->assertCreated()
->assertJsonPath('message', __('api.reports.created'))
->assertJsonPath('code', 'REPORT_CREATED')
->assertJsonPath('data.reason', ReportReason::SPAM->value)
->assertJsonPath('data.reportableType', 'meal_post')
->assertJsonPath('data.reportableId', $mealPost->id);
@@ -58,7 +58,7 @@ it('prevents duplicate reports and reports on own content', function () {
$this->postJson("/api/meal-posts/{$mealPost->id}/reports", $payload)
->assertConflict()
->assertJsonPath('message', __('api.reports.already_exists'));
->assertJsonPath('code', 'REPORT_ALREADY_EXISTS');
expect(Report::query()->count())->toBe(1);
@@ -66,7 +66,7 @@ it('prevents duplicate reports and reports on own content', function () {
$this->postJson("/api/meal-posts/{$mealPost->id}/reports", $payload)
->assertUnprocessable()
->assertJsonPath('message', __('api.reports.cannot_report_own_meal'));
->assertJsonPath('code', 'CANNOT_REPORT_OWN_MEAL');
});
it('reports users and prevents reporting own profile', function () {
@@ -94,7 +94,7 @@ it('reports users and prevents reporting own profile', function () {
'reason' => ReportReason::OTHER->value,
])
->assertUnprocessable()
->assertJsonPath('message', __('api.reports.cannot_report_self'));
->assertJsonPath('code', 'CANNOT_REPORT_SELF');
});
it('reports post reviews and prevents reporting own review', function () {
@@ -128,7 +128,7 @@ it('reports post reviews and prevents reporting own review', function () {
'reason' => ReportReason::OTHER->value,
])
->assertUnprocessable()
->assertJsonPath('message', __('api.reports.cannot_report_own_review'));
->assertJsonPath('code', 'CANNOT_REPORT_OWN_REVIEW');
});
it('notifies moderators once when a report threshold is reached', function () {