mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	fix: use correct docs API URL for feature strategy create/update (#1116)
* fix: use correct URL for update feature strategy * fix: use correct URL for create feature strategy
This commit is contained in:
		
							parent
							
								
									625a92ca74
								
							
						
					
					
						commit
						68bfde58f7
					
				| @ -0,0 +1,20 @@ | |||||||
|  | import { formatAddStrategyApiCode } from 'component/feature/FeatureStrategy/FeatureStrategyCreate/FeatureStrategyCreate'; | ||||||
|  | 
 | ||||||
|  | test('formatAddStrategyApiCode', () => { | ||||||
|  |     expect( | ||||||
|  |         formatAddStrategyApiCode( | ||||||
|  |             'projectId', | ||||||
|  |             'featureId', | ||||||
|  |             'environmentId', | ||||||
|  |             { id: 'strategyId' }, | ||||||
|  |             'unleashUrl' | ||||||
|  |         ) | ||||||
|  |     ).toMatchInlineSnapshot(` | ||||||
|  |       "curl --location --request POST 'unleashUrl/api/admin/projects/projectId/features/featureId/environments/environmentId/strategies' \\\\ | ||||||
|  |           --header 'Authorization: INSERT_API_KEY' \\\\ | ||||||
|  |           --header 'Content-Type: application/json' \\\\ | ||||||
|  |           --data-raw '{ | ||||||
|  |         \\"id\\": \\"strategyId\\" | ||||||
|  |       }'" | ||||||
|  |     `);
 | ||||||
|  | }); | ||||||
| @ -121,7 +121,7 @@ export const formatCreateStrategyPath = ( | |||||||
|     return `/projects/${projectId}/features/${featureId}/strategies/create?${params}`; |     return `/projects/${projectId}/features/${featureId}/strategies/create?${params}`; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| const formatAddStrategyApiCode = ( | export const formatAddStrategyApiCode = ( | ||||||
|     projectId: string, |     projectId: string, | ||||||
|     featureId: string, |     featureId: string, | ||||||
|     environmentId: string, |     environmentId: string, | ||||||
| @ -132,7 +132,7 @@ const formatAddStrategyApiCode = ( | |||||||
|         return ''; |         return ''; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     const url = `${unleashUrl}/api/admin/projects/${projectId}/features/${featureId}/${environmentId}/development/strategies`; |     const url = `${unleashUrl}/api/admin/projects/${projectId}/features/${featureId}/environments/${environmentId}/strategies`; | ||||||
|     const payload = JSON.stringify(strategy, undefined, 2); |     const payload = JSON.stringify(strategy, undefined, 2); | ||||||
| 
 | 
 | ||||||
|     return `curl --location --request POST '${url}' \\ |     return `curl --location --request POST '${url}' \\ | ||||||
|  | |||||||
| @ -0,0 +1,20 @@ | |||||||
|  | import { formatUpdateStrategyApiCode } from 'component/feature/FeatureStrategy/FeatureStrategyEdit/FeatureStrategyEdit'; | ||||||
|  | 
 | ||||||
|  | test('formatUpdateStrategyApiCode', () => { | ||||||
|  |     expect( | ||||||
|  |         formatUpdateStrategyApiCode( | ||||||
|  |             'projectId', | ||||||
|  |             'featureId', | ||||||
|  |             'environmentId', | ||||||
|  |             { id: 'strategyId' }, | ||||||
|  |             'unleashUrl' | ||||||
|  |         ) | ||||||
|  |     ).toMatchInlineSnapshot(` | ||||||
|  |       "curl --location --request PUT 'unleashUrl/api/admin/projects/projectId/features/featureId/environments/environmentId/strategies/strategyId' \\\\ | ||||||
|  |           --header 'Authorization: INSERT_API_KEY' \\\\ | ||||||
|  |           --header 'Content-Type: application/json' \\\\ | ||||||
|  |           --data-raw '{ | ||||||
|  |         \\"id\\": \\"strategyId\\" | ||||||
|  |       }'" | ||||||
|  |     `);
 | ||||||
|  | }); | ||||||
| @ -148,7 +148,7 @@ export const formatEditStrategyPath = ( | |||||||
|     return `/projects/${projectId}/features/${featureId}/strategies/edit?${params}`; |     return `/projects/${projectId}/features/${featureId}/strategies/edit?${params}`; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| const formatUpdateStrategyApiCode = ( | export const formatUpdateStrategyApiCode = ( | ||||||
|     projectId: string, |     projectId: string, | ||||||
|     featureId: string, |     featureId: string, | ||||||
|     environmentId: string, |     environmentId: string, | ||||||
| @ -159,7 +159,7 @@ const formatUpdateStrategyApiCode = ( | |||||||
|         return ''; |         return ''; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     const url = `${unleashUrl}/api/admin/projects/${projectId}/features/${featureId}/${environmentId}/development/strategies/${strategy.id}`; |     const url = `${unleashUrl}/api/admin/projects/${projectId}/features/${featureId}/environments/${environmentId}/strategies/${strategy.id}`; | ||||||
|     const payload = JSON.stringify(strategy, undefined, 2); |     const payload = JSON.stringify(strategy, undefined, 2); | ||||||
| 
 | 
 | ||||||
|     return `curl --location --request PUT '${url}' \\ |     return `curl --location --request PUT '${url}' \\ | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user