<commit_before><?php

declare(strict_types=1);

namespace Keboola\Test\Common;

use Keboola\Csv\CsvFile;
use Keboola\Test\StorageApiTestCase;

class JobsListTest extends StorageApiTestCase
{
    public function setUp()
    {
        parent::setUp();
        $this->_initEmptyTestBuckets();
        // make 5 dummy jobs
        for ($i = 0; $i < 5; $i++) {
            $this->_client->createTableAsync(
                $this->getTestBucketId(),
                'dummy_job_'. $i,
                new CsvFile(__DIR__ . '/../_data/languages.csv')
            );
        }
    }

    public function testJobsListing(): void
    {
        $jobs = $this->_client->listJobs();

        // the default limit is 20 jobs
        $this->assertLessThanOrEqual(20, count($jobs));

        // get only 5 jobs
        $fiveJobs = $this->_client->listJobs(["limit" => 5]);
        $this->assertLessThanOrEqual(5, count($fiveJobs));

        // check the offset parameter
        $firstJob = $fiveJobs[0];
        $secondJob = $fiveJobs[1];
        $offsetJobs = $this->_client->listJobs(["limit" => 5, "offset" => 1]);
        $this->assertNotEquals($firstJob, $offsetJobs[0]);
        $this->assertEquals($secondJob, $offsetJobs[0]);
    }
}
<commit_msg>use just 2 jobs instead of 5<commit_after><?php

declare(strict_types=1);

namespace Keboola\Test\Common;

use Keboola\Csv\CsvFile;
use Keboola\Test\StorageApiTestCase;

class JobsListTest extends StorageApiTestCase
{
    public function setUp()
    {
        parent::setUp();
        $this->_initEmptyTestBuckets();
        // make 2 jobs
        for ($i = 0; $i < 2; $i++) {
            $this->_client->createTableAsync(
                $this->getTestBucketId(),
                'dummy_job_'. $i,
                new CsvFile(__DIR__ . '/../_data/languages.csv')
            );
        }
    }

    public function testJobsListing(): void
    {
        $jobs = $this->_client->listJobs();

        // the default limit is 20 jobs
        $this->assertLessThanOrEqual(20, count($jobs));

        // get only 2 jobs
        $twoJobs = $this->_client->listJobs(["limit" => 2]);
        $this->assertEquals(2, count($twoJobs));

        // check the offset parameter
        $firstJob = $twoJobs[0];
        $secondJob = $twoJobs[1];
        $offsetJobs = $this->_client->listJobs(["limit" => 2, "offset" => 1]);
        $this->assertNotEquals($firstJob, $offsetJobs[0]);
        $this->assertEquals($secondJob, $offsetJobs[0]);
    }
}

{'fraction_non_alphanumeric': 0.1553398058252427, 'fraction_numerical': 0.014563106796116505, 'mean_word_length': 2.279840848806366, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '751280', 'n_tokens_mistral': 826, 'n_tokens_neox': 781, 'n_words': 153}