<?php

namespace Tests\Feature\Organization;

use CodeIgniter\Test\FeatureTestTrait;
use CodeIgniter\Test\CIUnitTestCase;

class CodingSysControllerTest extends CIUnitTestCase
{
    use FeatureTestTrait;

    protected $endpoint = 'api/organization/codingsys';

    public function testIndexCodingSys()
    {
        $result = $this->get($this->endpoint);
        $result->assertStatus(200);
    }

    public function testCreateCodingSys()
    {
        $payload = [
            'CodingSysAbb' => 'ICD' . substr(time(), -3),
            'FullText' => 'International Classification of Diseases 10 ' . time(),
            'Description' => 'Medical diagnosis coding system'
        ];

        $result = $this->withBodyFormat('json')->post($this->endpoint, $payload);
        $result->assertStatus(201);
    }
}
