<?php

namespace App\Tests\Message;

use App\Message\MeilisearchMessage;
use PHPUnit\Framework\TestCase;

class MeilisearchMessageTest extends TestCase
{
    public function testConstructorSetsProperties(): void
    {
        $message = new MeilisearchMessage('addDocuments', 'events', ['documents' => [['id' => 1]]]);

        self::assertSame('addDocuments', $message->action);
        self::assertSame('events', $message->index);
        self::assertSame(['documents' => [['id' => 1]]], $message->payload);
    }

    public function testDefaultPayloadIsEmpty(): void
    {
        $message = new MeilisearchMessage('deleteIndex', 'events');

        self::assertSame([], $message->payload);
    }
}
