Skip to content

Commit

Permalink
add test testOkFromMecabOnly
Browse files Browse the repository at this point in the history
  • Loading branch information
bvlion committed Aug 7, 2024
1 parent f905e4d commit 041c4da
Showing 1 changed file with 77 additions and 0 deletions.
77 changes: 77 additions & 0 deletions tests/Application/Actions/Dgo/CreateDgoActionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,83 @@ public function testOkFromMecabOnly()

$this->assertEquals(json_encode(['text' => 'DD']), $payload);
$this->assertEquals(200, $response->getStatusCode());

$request = $this->createRequest('GET', '/get-dai-go')
->withHeader('Authorization', 'Bearer test_test_test')
->withHeader('Content-Type', 'application/json')
->withQueryParams(['target' => '絵文字が多い']);
$response = $app->handle($request);

$payload = (string) $response->getBody();

$this->assertEquals(json_encode(['text' => 'EO']), $payload);
$this->assertEquals(200, $response->getStatusCode());

$request = $this->createRequest('GET', '/get-dai-go')
->withHeader('Authorization', 'Bearer test_test_test')
->withHeader('Content-Type', 'application/json')
->withQueryParams(['target' => '地下だと十分に涼しい']);
$response = $app->handle($request);

$payload = (string) $response->getBody();

$this->assertEquals(json_encode(['text' => 'CJS']), $payload);
$this->assertEquals(200, $response->getStatusCode());

$request = $this->createRequest('GET', '/get-dai-go')
->withHeader('Authorization', 'Bearer test_test_test')
->withHeader('Content-Type', 'application/json')
->withQueryParams(['target' => '学校の校庭で座禅']);
$response = $app->handle($request);

$payload = (string) $response->getBody();

$this->assertEquals(json_encode(['text' => 'GKZ']), $payload);
$this->assertEquals(200, $response->getStatusCode());

$request = $this->createRequest('GET', '/get-dai-go')
->withHeader('Authorization', 'Bearer test_test_test')
->withHeader('Content-Type', 'application/json')
->withQueryParams(['target' => '何か変な帽子']);
$response = $app->handle($request);

$payload = (string) $response->getBody();

$this->assertEquals(json_encode(['text' => 'NHB']), $payload);
$this->assertEquals(200, $response->getStatusCode());

$request = $this->createRequest('GET', '/get-dai-go')
->withHeader('Authorization', 'Bearer test_test_test')
->withHeader('Content-Type', 'application/json')
->withQueryParams(['target' => '事前にパジャマを着て待つ']);
$response = $app->handle($request);

$payload = (string) $response->getBody();

$this->assertEquals(json_encode(['text' => 'JPKM']), $payload);
$this->assertEquals(200, $response->getStatusCode());

$request = $this->createRequest('GET', '/get-dai-go')
->withHeader('Authorization', 'Bearer test_test_test')
->withHeader('Content-Type', 'application/json')
->withQueryParams(['target' => 'レース会場にようこそ']);
$response = $app->handle($request);

$payload = (string) $response->getBody();

$this->assertEquals(json_encode(['text' => 'RKY']), $payload);
$this->assertEquals(200, $response->getStatusCode());

$request = $this->createRequest('GET', '/get-dai-go')
->withHeader('Authorization', 'Bearer test_test_test')
->withHeader('Content-Type', 'application/json')
->withQueryParams(['target' => '綿毛のW']);
$response = $app->handle($request);

$payload = (string) $response->getBody();

$this->assertEquals(json_encode(['text' => 'WW']), $payload);
$this->assertEquals(200, $response->getStatusCode());
}

public function testOkFromMecabWithNotExistsFile()
Expand Down

0 comments on commit 041c4da

Please sign in to comment.