You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pixelfed/tests/Feature/AdminRemoveCwTest.php

46 lines
1.3 KiB
PHTML

4 weeks ago
<?php
use App\Models\Status;
use App\Models\User;
4 weeks ago
use Illuminate\Foundation\Testing\LazilyRefreshDatabase;
uses(LazilyRefreshDatabase::class);
/*
|--------------------------------------------------------------------------
| Admin Remove CW - Regression Tests
|--------------------------------------------------------------------------
|
| Ensures that removing a content warning via the moderation action does
| not crash when no AccountInterstitial record exists (user-set CW).
|
*/
describe('admin remove content warning', function () {
it('succeeds when no AccountInterstitial exists for the CW post', function () {
$admin = User::factory()->admin()->create();
$admin->refresh();
$user = User::factory()->create();
$user->refresh();
$status = Status::factory()->nsfw()->create([
'profile_id' => $user->profile->id,
'uri' => null,
]);
expect($status->is_nsfw)->toBeTrue();
$this->actingAs($admin)
->postJson('/api/v2/moderator/action', [
'action' => 'remcw',
'item_id' => $status->id,
'item_type' => 'status',
])
->assertOk();
$status->refresh();
expect((bool) $status->is_nsfw)->toBeFalse();
});
});