mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-07-13 18:05:31 +02:00
test(helpers): add tests for handling empty and undefined string variables in templates
- Introduced new test cases to verify the behavior of the `processValue` function when dealing with empty string variables and undefined variables. - Ensured that empty strings are correctly replaced and undefined variables remain unchanged in the output.
This commit is contained in:
@@ -170,12 +170,12 @@ export function processValue(
|
||||
}
|
||||
|
||||
// If not a utility function, try to get from variables
|
||||
return variables[varName] || match;
|
||||
return varName in variables ? (variables[varName] ?? match) : match;
|
||||
});
|
||||
|
||||
// Then replace any remaining ${var} with their values from variables
|
||||
processedValue = processedValue.replace(/\${([^}]+)}/g, (match, varName) => {
|
||||
return variables[varName] || match;
|
||||
return varName in variables ? (variables[varName] ?? match) : match;
|
||||
});
|
||||
|
||||
return processedValue;
|
||||
|
||||
Reference in New Issue
Block a user