use strict;
use warnings;

use Leek::IntegrationTest;

with_server {
    my $response;

    $response = send_command "APPEND ONTO 'events' ENTRY 'hello'";
    assert_response_size $response, 2;
    assert_response_part $response, 0, 1, 'Unknown journal';
    assert_response_part $response, 1, 2, '';

    $response = send_command "CREATE JOURNAL 'events'";
    assert_response_size $response, 1;
    assert_response_part $response, 0, 2, '';

    $response = send_command "APPEND ONTO 'events' ENTRY 'hello'";
    assert_response_size $response, 1;
    assert_response_part $response, 0, 2, '';

    $response = send_command "APPEND ONTO 'events' ENTRY 'world'";
    assert_response_size $response, 1;
    assert_response_part $response, 0, 2, '';

    $response = send_command "ENUMERATE 'events'";
    assert_response_size $response, 3;
    assert_response_part $response, 0, 0, 'hello';
    assert_response_part $response, 1, 0, 'world';
    assert_response_part $response, 2, 2, '';
};
