重构猜谜活动并统一聊天室答题通知
This commit is contained in:
@@ -444,6 +444,33 @@ class UserControllerTest extends TestCase
|
||||
], $user->chat_preferences);
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试猜谜活动新文案会兼容落回旧的屏蔽键。
|
||||
*/
|
||||
public function test_quiz_activity_block_preference_is_normalized_to_legacy_sender_key(): void
|
||||
{
|
||||
$user = User::factory()->create([
|
||||
'chat_preferences' => null,
|
||||
]);
|
||||
|
||||
$response = $this->actingAs($user)->putJson('/user/chat-preferences', [
|
||||
'blocked_system_senders' => ['猜谜活动', '钓鱼播报'],
|
||||
'sound_muted' => false,
|
||||
]);
|
||||
|
||||
$response->assertOk()
|
||||
->assertJsonPath('status', 'success')
|
||||
->assertJsonPath('data.blocked_system_senders.0', '猜成语')
|
||||
->assertJsonPath('data.blocked_system_senders.1', '钓鱼播报')
|
||||
->assertJsonPath('data.sound_muted', false);
|
||||
|
||||
$user->refresh();
|
||||
$this->assertEquals([
|
||||
'blocked_system_senders' => ['猜成语', '钓鱼播报'],
|
||||
'sound_muted' => false,
|
||||
], $user->chat_preferences);
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试合法聊天室当日状态可以保存,并在当天结束后自动失效。
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user