feat: translation codes
This commit is contained in:
@@ -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 () {
|
||||
|
||||
Reference in New Issue
Block a user