修复悄悄话文字颜色及不能发数字0的问题
This commit is contained in:
@@ -67,6 +67,39 @@ class ChatControllerTest extends TestCase
|
||||
$this->assertTrue($found, 'Message not found in Redis');
|
||||
}
|
||||
|
||||
public function test_can_send_zero_message_content(): void
|
||||
{
|
||||
$room = Room::create(['room_name' => 'test_send_zero']);
|
||||
$user = User::factory()->create();
|
||||
|
||||
$this->actingAs($user)->get(route('chat.room', $room->id));
|
||||
|
||||
$response = $this->actingAs($user)->postJson(route('chat.send', $room->id), [
|
||||
'to_user' => '大家',
|
||||
'content' => '0',
|
||||
'is_secret' => false,
|
||||
'font_color' => '#000000',
|
||||
'action' => '',
|
||||
]);
|
||||
|
||||
$response->assertOk();
|
||||
$response->assertJson(['status' => 'success']);
|
||||
|
||||
$messages = Redis::lrange("room:{$room->id}:messages", 0, -1);
|
||||
$found = false;
|
||||
|
||||
foreach ($messages as $msgJson) {
|
||||
$msg = json_decode($msgJson, true);
|
||||
|
||||
if ($msg['from_user'] === $user->username && $msg['content'] === '0') {
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$this->assertTrue($found, 'Zero message not found in Redis');
|
||||
}
|
||||
|
||||
public function test_can_trigger_heartbeat()
|
||||
{
|
||||
$room = Room::create(['room_name' => 'test_hb']);
|
||||
|
||||
Reference in New Issue
Block a user