Add tests covering country code validation

This commit is contained in:
Alejandro Celaya
2024-11-14 09:40:10 +01:00
parent fd34332e69
commit 7ddb3e7a70
2 changed files with 38 additions and 0 deletions

View File

@@ -96,6 +96,20 @@ class SetRedirectRulesTest extends ApiTestCase
],
],
]], 'invalid IP address')]
#[TestWith([[
'redirectRules' => [
[
'longUrl' => 'https://example.com',
'conditions' => [
[
'type' => 'geolocation-country-code',
'matchKey' => null,
'matchValue' => 'not a country code',
],
],
],
],
]], 'invalid country code')]
public function errorIsReturnedWhenInvalidDataIsProvided(array $bodyPayload): void
{
$response = $this->callApiWithKey(self::METHOD_POST, '/short-urls/abc123/redirect-rules', [