V2Wizard/Test: Add docstring to preparePathname helper
preparePathname() is called by the render() test helper function, this commit adds a docstring (JSDoc format) with examples to document how it works.
This commit is contained in:
parent
ad5d2007bb
commit
25a5ff7772
1 changed files with 10 additions and 2 deletions
|
|
@ -55,7 +55,15 @@ export const blueprintRequest: CreateBlueprintRequest = {
|
|||
customizations: {},
|
||||
};
|
||||
|
||||
const preparePathname = (searchParams: {}) => {
|
||||
/**
|
||||
* @example
|
||||
* // returns 'imageWizard?release=rhel8&architecture=aarch64'
|
||||
* preparePathname({ release: 'rhel8', architecture: 'aarch64' });
|
||||
* @example
|
||||
* // returns 'imageWizard'
|
||||
* preparePathname({});
|
||||
*/
|
||||
function preparePathname(searchParams: { [key: string]: string } = {}): string {
|
||||
let pathName = 'imageWizard';
|
||||
const params = Object.entries(searchParams).map(
|
||||
([param, value]) => `${param}=${value}`
|
||||
|
|
@ -64,7 +72,7 @@ const preparePathname = (searchParams: {}) => {
|
|||
pathName += `?${params.join('&')}`;
|
||||
}
|
||||
return pathName;
|
||||
};
|
||||
}
|
||||
|
||||
export const render = async (searchParams = {}) => {
|
||||
const pathName = preparePathname(searchParams);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue