Skip to content

Commit

Permalink
Add feature test to prove bug is fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Koen Eelen committed Sep 10, 2024
1 parent 1512182 commit 78c08ba
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
8 changes: 8 additions & 0 deletions features/Steps/UtilitySteps.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ trait UtilitySteps
{
private bool $initialPreventDuplicatePlaceCreationValue;

/**
* @Given /^I create a name that includes special characters and keep it as "([^"]*)"$/
*/
public function iCreateANameOfCharactersThatIncludesSpecialCharactersAndKeepItAs(string $variableName)
{
$this->variableState->setVariable($variableName, '(a)![a]' . uniqid('', true));
}

/**
* @Given I create a random name of :nrOfCharacters characters
*/
Expand Down
20 changes: 19 additions & 1 deletion features/place/duplicate.feature
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,22 @@ Feature: Test creating places
"duplicatePlaceUri": "%{baseUrl}/place/%{originalPlaceId}"
}
"""
Then I restore the duplicate configuration
Then I restore the duplicate configuration

Scenario: Be prevented from creating a new place if we already have one on that address when the the address contains special chars
Given I prevent duplicate place creation
Given I create a name that includes special characters and keep it as "name"
Given I create a minimal place and save the "id" as "originalPlaceId" then I should get a "201" response code
Then I wait for the place with url "/places/%{originalPlaceId}" to be indexed
Given I create a minimal place then I should get a "409" response code
Then the JSON response should be:
"""
{
"type": "https://api.publiq.be/probs/uitdatabank/duplicate-place",
"title": "Duplicate place",
"status": 409,
"detail": "A place with this address / name combination already exists. Please use the existing place for your purposes.",
"duplicatePlaceUri": "%{baseUrl}/place/%{originalPlaceId}"
}
"""
Then I restore the duplicate configuration

0 comments on commit 78c08ba

Please sign in to comment.