Added API test covering invalid tagsMode

This commit is contained in:
Alejandro Celaya 2022-01-04 14:42:31 +01:00
parent 0447aa07fa
commit 9dec05f62d

View file

@ -241,4 +241,21 @@ class ListShortUrlsTest extends ApiTestCase
'totalItems' => $itemsCount,
];
}
/** @test */
public function errorIsReturnedWhenProvidingInvalidValues(): void
{
$query = ['tagsMode' => 'invalid'];
$resp = $this->callApiWithKey(self::METHOD_GET, '/short-urls', [RequestOptions::QUERY => $query]);
$respPayload = $this->getJsonResponsePayload($resp);
self::assertEquals(400, $resp->getStatusCode());
self::assertEquals([
'invalidElements' => ['tagsMode'],
'title' => 'Invalid data',
'type' => 'INVALID_ARGUMENT',
'status' => 400,
'detail' => 'Provided data is not valid',
], $respPayload);
}
}