@spinnaker/amazon 2026.3.2 → 2026.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (202) hide show
  1. package/dist/common/AwsModalFooter.d.ts +1 -1
  2. package/dist/deploymentStrategy/AdditionalFields.d.ts +1 -1
  3. package/dist/function/CreateLambdaFunction.d.ts +1 -1
  4. package/dist/function/configure/ExecutionRole.d.ts +1 -1
  5. package/dist/function/configure/FunctionBasicInformation.d.ts +1 -1
  6. package/dist/function/configure/FunctionDebugAndErrorHandling.d.ts +1 -1
  7. package/dist/function/configure/FunctionEnvironmentVariables.d.ts +1 -1
  8. package/dist/function/configure/FunctionSettings.d.ts +1 -1
  9. package/dist/function/configure/FunctionTags.d.ts +1 -1
  10. package/dist/function/configure/Network.d.ts +1 -1
  11. package/dist/function/details/AmazonFunctionDetails.d.ts +1 -1
  12. package/dist/function/details/FunctionActions.d.ts +1 -1
  13. package/dist/index.js +279 -1
  14. package/dist/index.js.map +1 -1
  15. package/dist/instance/details/AmazonInstanceInformation.d.ts +2 -2
  16. package/dist/instance/details/CostFactor.d.ts +2 -2
  17. package/dist/instance/details/InstanceDns.d.ts +2 -2
  18. package/dist/instance/details/InstanceInformation.d.ts +2 -2
  19. package/dist/instance/details/InstanceSecurityGroups.d.ts +2 -2
  20. package/dist/instance/details/InstanceStatus.d.ts +2 -2
  21. package/dist/instance/details/InstanceTags.d.ts +2 -2
  22. package/dist/loadBalancer/configure/AmazonLoadBalancerChoiceModal.d.ts +1 -1
  23. package/dist/loadBalancer/configure/application/ALBListeners.d.ts +1 -1
  24. package/dist/loadBalancer/configure/application/ConfigureOidcConfigModal.d.ts +1 -1
  25. package/dist/loadBalancer/configure/application/ConfigureRedirectConfigModal.d.ts +1 -1
  26. package/dist/loadBalancer/configure/application/CreateApplicationLoadBalancer.d.ts +1 -1
  27. package/dist/loadBalancer/configure/application/TargetGroups.d.ts +1 -1
  28. package/dist/loadBalancer/configure/classic/AdvancedSettings.d.ts +1 -1
  29. package/dist/loadBalancer/configure/classic/HealthCheck.d.ts +1 -1
  30. package/dist/loadBalancer/configure/classic/Listeners.d.ts +1 -1
  31. package/dist/loadBalancer/configure/common/AmazonCertificateSelectField.d.ts +1 -1
  32. package/dist/loadBalancer/configure/common/LoadBalancerLocation.d.ts +1 -1
  33. package/dist/loadBalancer/configure/common/SecurityGroups.d.ts +1 -1
  34. package/dist/loadBalancer/configure/network/CertificateSelectors.d.ts +2 -2
  35. package/dist/loadBalancer/configure/network/NLBListeners.d.ts +1 -1
  36. package/dist/loadBalancer/configure/network/TargetGroups.d.ts +1 -1
  37. package/dist/loadBalancer/details/LoadBalancerActions.d.ts +1 -1
  38. package/dist/pipeline/stages/AmazonStageConfig.d.ts +2 -2
  39. package/dist/pipeline/stages/bake/AwsBakeStageConfig.d.ts +2 -2
  40. package/dist/pipeline/stages/cloneServerGroup/AwsCloneServerGroupStageConfig.d.ts +2 -2
  41. package/dist/pipeline/stages/deleteLambda/DeleteLambdaFunctionStageForm.d.ts +2 -2
  42. package/dist/pipeline/stages/deleteLambda/LambdaDeleteStage.d.ts +2 -2
  43. package/dist/pipeline/stages/deleteLambda/constants/deleteVersion.picker.d.ts +1 -1
  44. package/dist/pipeline/stages/deployCloudFormation/CloudFormationChangeSetInfo.d.ts +2 -2
  45. package/dist/pipeline/stages/deployCloudFormation/DeployCloudFormationStackStageConfig.d.ts +2 -2
  46. package/dist/pipeline/stages/deployCloudFormation/deployCloudFormationExecutionDetails.d.ts +1 -1
  47. package/dist/pipeline/stages/deployCloudFormation/evaluateCloudFormationChangeSetExecutionApproval.d.ts +2 -2
  48. package/dist/pipeline/stages/deployCloudFormation/evaluateCloudFormationChangeSetExecutionDetails.d.ts +1 -1
  49. package/dist/pipeline/stages/deployCloudFormation/evaluateCloudFormationChangeSetExecutionLabel.d.ts +1 -1
  50. package/dist/pipeline/stages/deployCloudFormation/evaluateCloudFormationChangeSetExecutionMarkerIcon.d.ts +1 -1
  51. package/dist/pipeline/stages/deployLambda/components/AwsLambdaFunctionStageForm.d.ts +2 -2
  52. package/dist/pipeline/stages/deployLambda/components/BasicSettingsForm.d.ts +2 -2
  53. package/dist/pipeline/stages/deployLambda/components/EnvironmentForm.d.ts +2 -2
  54. package/dist/pipeline/stages/deployLambda/components/ExecutionRoleForm.d.ts +2 -2
  55. package/dist/pipeline/stages/deployLambda/components/LambdaAtEdgeForm.d.ts +2 -2
  56. package/dist/pipeline/stages/deployLambda/components/NetworkForm.d.ts +2 -2
  57. package/dist/pipeline/stages/deployLambda/components/TriggerEventsForm.d.ts +2 -2
  58. package/dist/pipeline/stages/deployLambda/config/LambdaDeploymentStageConfig.d.ts +2 -2
  59. package/dist/pipeline/stages/deployLambda/config/LambdaDeploymentStageExecutionDetails.d.ts +2 -2
  60. package/dist/pipeline/stages/disableAsg/AwsDisableAsgStageConfig.d.ts +2 -2
  61. package/dist/pipeline/stages/disableCluster/AwsDisableClusterStageConfig.d.ts +2 -2
  62. package/dist/pipeline/stages/enableAsg/AwsEnableAsgStageConfig.d.ts +2 -2
  63. package/dist/pipeline/stages/findImageFromTags/AwsFindImageFromTagsStageConfig.d.ts +2 -2
  64. package/dist/pipeline/stages/invokeLambda/InvokeLambdaFunctionStageForm.d.ts +2 -2
  65. package/dist/pipeline/stages/invokeLambda/LambdaInvokeStage.d.ts +2 -2
  66. package/dist/pipeline/stages/invokeLambda/components/InvokeLambdaOperation.d.ts +2 -2
  67. package/dist/pipeline/stages/modifyScalingProcess/ModifyScalingProcessStageConfig.d.ts +2 -2
  68. package/dist/pipeline/stages/modifyWarmPool/ModifyWarmPoolStageConfig.d.ts +2 -2
  69. package/dist/pipeline/stages/resizeAsg/AwsResizeAsgStageConfig.d.ts +2 -2
  70. package/dist/pipeline/stages/rollbackCluster/AwsRollbackClusterStageConfig.d.ts +2 -2
  71. package/dist/pipeline/stages/routeLambda/LambdaRouteStage.d.ts +2 -2
  72. package/dist/pipeline/stages/routeLambda/RouteLambdaFunctionStageForm.d.ts +2 -2
  73. package/dist/pipeline/stages/routeLambda/TriggerEventsForm.d.ts +2 -2
  74. package/dist/pipeline/stages/routeLambda/components/BlueGreenDeployment/BlueGreenDeploymentForm.d.ts +2 -2
  75. package/dist/pipeline/stages/routeLambda/components/BlueGreenDeployment/HealthCheckStrategy.d.ts +2 -2
  76. package/dist/pipeline/stages/routeLambda/components/BlueGreenDeployment/InvocationHealthCheck.d.ts +2 -2
  77. package/dist/pipeline/stages/routeLambda/components/DeploymentStrategyForm.d.ts +2 -2
  78. package/dist/pipeline/stages/routeLambda/components/RenderStrategy.d.ts +2 -2
  79. package/dist/pipeline/stages/routeLambda/components/SimpleDeploymentForm.d.ts +2 -2
  80. package/dist/pipeline/stages/routeLambda/components/VersionPicker.d.ts +1 -1
  81. package/dist/pipeline/stages/routeLambda/components/WeightedDeploymentForm.d.ts +2 -2
  82. package/dist/pipeline/stages/routeLambda/constants/strategy.picker.d.ts +1 -1
  83. package/dist/pipeline/stages/scaleDownCluster/AwsScaleDownClusterStageConfig.d.ts +2 -2
  84. package/dist/pipeline/stages/shrinkCluster/AwsShrinkClusterStageConfig.d.ts +2 -2
  85. package/dist/pipeline/stages/tagImage/awsTagImageStage.d.ts +2 -2
  86. package/dist/pipeline/stages/updateCodeLambda/LambdaUpdateCodeStageConfig.d.ts +2 -2
  87. package/dist/pipeline/stages/updateCodeLambda/LambdaUpdateCodeStageExecutionDetails.d.ts +2 -2
  88. package/dist/pipeline/stages/updateCodeLambda/components/UpdateCodeStageForm.d.ts +2 -2
  89. package/dist/securityGroup/details/IPRangeRules.d.ts +1 -1
  90. package/dist/serverGroup/configure/AmazonImageSelectInput.d.ts +1 -1
  91. package/dist/serverGroup/configure/wizard/AmazonCloneServerGroupModal.d.ts +1 -1
  92. package/dist/serverGroup/configure/wizard/ServerGroupTemplateSelection.d.ts +1 -1
  93. package/dist/serverGroup/configure/wizard/capacity/CapacitySelector.d.ts +1 -1
  94. package/dist/serverGroup/configure/wizard/capacity/MinMaxDesired.d.ts +1 -1
  95. package/dist/serverGroup/configure/wizard/instanceType/CpuCreditsToggle.d.ts +2 -2
  96. package/dist/serverGroup/configure/wizard/instanceType/InstanceTypeSelector.d.ts +2 -2
  97. package/dist/serverGroup/configure/wizard/instanceType/InstanceTypeWarning.d.ts +2 -2
  98. package/dist/serverGroup/configure/wizard/instanceType/advancedMode/AdvancedModeSelector.d.ts +2 -2
  99. package/dist/serverGroup/configure/wizard/instanceType/advancedMode/AmazonInstanceTypeInfoRenderer.d.ts +2 -2
  100. package/dist/serverGroup/configure/wizard/instanceType/advancedMode/InstanceProfileSelector.d.ts +2 -2
  101. package/dist/serverGroup/configure/wizard/instanceType/advancedMode/InstanceTypeRow.d.ts +2 -2
  102. package/dist/serverGroup/configure/wizard/instanceType/advancedMode/InstanceTypeSelect.d.ts +2 -2
  103. package/dist/serverGroup/configure/wizard/instanceType/advancedMode/InstanceTypeTable.d.ts +2 -2
  104. package/dist/serverGroup/configure/wizard/instanceType/advancedMode/InstanceTypeTableBody.d.ts +2 -2
  105. package/dist/serverGroup/configure/wizard/instanceType/advancedMode/InstanceTypeTableParts.d.ts +4 -4
  106. package/dist/serverGroup/configure/wizard/instanceType/advancedMode/InstancesDistribution.d.ts +2 -2
  107. package/dist/serverGroup/configure/wizard/instanceType/simpleMode/SimpleModeSelector.d.ts +2 -2
  108. package/dist/serverGroup/configure/wizard/pages/ServerGroupBasicSettings.d.ts +1 -1
  109. package/dist/serverGroup/configure/wizard/pages/ServerGroupCapacity.d.ts +1 -1
  110. package/dist/serverGroup/configure/wizard/pages/ServerGroupInstanceType.d.ts +1 -1
  111. package/dist/serverGroup/configure/wizard/pages/ServerGroupLoadBalancers.d.ts +1 -1
  112. package/dist/serverGroup/configure/wizard/pages/ServerGroupSecurityGroups.d.ts +1 -1
  113. package/dist/serverGroup/configure/wizard/pages/ServerGroupZones.d.ts +1 -1
  114. package/dist/serverGroup/configure/wizard/pages/advancedSettings/ServerGroupAdvancedSettings.d.ts +1 -1
  115. package/dist/serverGroup/configure/wizard/pages/advancedSettings/ServerGroupAdvancedSettingsCommon.d.ts +1 -1
  116. package/dist/serverGroup/configure/wizard/pages/advancedSettings/ServerGroupAdvancedSettingsInner.d.ts +1 -1
  117. package/dist/serverGroup/configure/wizard/securityGroups/SecurityGroupSelector.d.ts +1 -1
  118. package/dist/serverGroup/configure/wizard/securityGroups/ServerGroupSecurityGroupsRemoved.d.ts +1 -1
  119. package/dist/serverGroup/details/advancedSettings/EditAsgAdvancedSettingsModal.d.ts +2 -1
  120. package/dist/serverGroup/details/resize/AmazonResizeServerGroupModal.d.ts +1 -1
  121. package/dist/serverGroup/details/scalingPolicy/CreateScalingPolicyButton.d.ts +1 -1
  122. package/dist/serverGroup/details/scalingPolicy/ScalingPolicySummary.d.ts +2 -2
  123. package/dist/serverGroup/details/scalingPolicy/StepPolicySummary.d.ts +2 -2
  124. package/dist/serverGroup/details/scalingPolicy/chart/DateLineChart.d.ts +2 -2
  125. package/dist/serverGroup/details/scalingPolicy/chart/MetricAlarmChart.d.ts +3 -3
  126. package/dist/serverGroup/details/scalingPolicy/popover/AlarmSummary.d.ts +2 -2
  127. package/dist/serverGroup/details/scalingPolicy/popover/StepPolicyPopoverContent.d.ts +2 -2
  128. package/dist/serverGroup/details/scalingPolicy/targetTracking/TargetMetricFields.d.ts +2 -2
  129. package/dist/serverGroup/details/scalingPolicy/targetTracking/TargetTrackingAdditionalSettings.d.ts +2 -3
  130. package/dist/serverGroup/details/scalingPolicy/targetTracking/TargetTrackingChart.d.ts +2 -2
  131. package/dist/serverGroup/details/scalingPolicy/targetTracking/TargetTrackingSummary.d.ts +2 -2
  132. package/dist/serverGroup/details/scalingPolicy/targetTracking/UpsertTargetTrackingModal.d.ts +2 -2
  133. package/dist/serverGroup/details/scalingPolicy/upsert/PolicyTypeSelectionModal.d.ts +2 -2
  134. package/dist/serverGroup/details/scalingPolicy/upsert/ScalingPolicyAdditionalSettings.d.ts +2 -2
  135. package/dist/serverGroup/details/scalingPolicy/upsert/UpsertScalingPolicyModal.d.ts +2 -2
  136. package/dist/serverGroup/details/scalingPolicy/upsert/alarm/AlarmConfigurer.d.ts +2 -2
  137. package/dist/serverGroup/details/scalingPolicy/upsert/alarm/DimensionsEditor.d.ts +2 -2
  138. package/dist/serverGroup/details/scalingPolicy/upsert/alarm/MetricSelector.d.ts +2 -2
  139. package/dist/serverGroup/details/scalingPolicy/upsert/simple/SimplePolicyAction.d.ts +2 -2
  140. package/dist/serverGroup/details/scalingPolicy/upsert/step/StepPolicyAction.d.ts +2 -2
  141. package/dist/serverGroup/details/scalingProcesses/ModifyScalingProcessesModal.d.ts +1 -1
  142. package/dist/serverGroup/details/scheduledAction/ScheduledAction.d.ts +1 -1
  143. package/dist/serverGroup/details/scheduledActions/EditScheduledActionsModal.d.ts +1 -1
  144. package/dist/serverGroup/details/sections/InstancesDistributionDetailsSection.d.ts +2 -2
  145. package/dist/serverGroup/details/sections/LaunchTemplateDetailsSection.d.ts +2 -2
  146. package/dist/serverGroup/details/sections/MultipleInstanceTypesSubSection.d.ts +2 -2
  147. package/dist/serverGroup/details/securityGroups/EditSecurityGroupsModal.d.ts +1 -1
  148. package/dist/serverGroup/details/warmPool/ModifyWarmPoolModal.d.ts +1 -1
  149. package/dist/subnet/SubnetSelectField.d.ts +1 -1
  150. package/dist/subnet/SubnetSelectInput.d.ts +1 -1
  151. package/dist/vpc/VpcTag.d.ts +2 -2
  152. package/package.json +5 -7
  153. package/src/aws.module.spec.ts +20 -21
  154. package/src/function/details/AmazonFunctionDetails.tsx +1 -1
  155. package/src/function/details/FunctionActions.spec.tsx +56 -36
  156. package/src/instance/awsInstanceType.service.spec.js +24 -22
  157. package/src/instance/details/AmazonInstanceDetails.spec.tsx +7 -7
  158. package/src/instance/details/InstanceInformation.spec.tsx +44 -24
  159. package/src/loadBalancer/AmazonLoadBalancersTag.spec.tsx +1 -1
  160. package/src/loadBalancer/TargetGroupDetails.spec.tsx +5 -5
  161. package/src/loadBalancer/configure/application/TargetGroups.tsx +1 -1
  162. package/src/loadBalancer/configure/common/SecurityGroups.spec.tsx +4 -4
  163. package/src/loadBalancer/configure/network/TargetGroups.tsx +1 -1
  164. package/src/loadBalancer/details/amazonLoadBalancerDetails.spec.tsx +31 -53
  165. package/src/pipeline/stages/AmazonStageConfig.spec.tsx +37 -46
  166. package/src/pipeline/stages/deployCloudFormation/DeployCloudFormationStackStageConfig.tsx +1 -0
  167. package/src/pipeline/stages/deployCloudFormation/deployCloudFormationStackStage.spec.tsx +316 -279
  168. package/src/pipeline/stages/findImageFromTags/AwsFindImageFromTagsStageConfig.spec.tsx +70 -90
  169. package/src/pipeline/stages/modifyScalingProcess/modifyScalingProcessStage.spec.tsx +198 -130
  170. package/src/pipeline/stages/modifyWarmPool/modifyWarmPoolStage.spec.tsx +49 -40
  171. package/src/pipeline/stages/resizeAsg/AwsResizeAsgStageConfig.spec.tsx +341 -427
  172. package/src/pipeline/stages/resizeAsg/AwsResizeAsgStageConfig.tsx +7 -0
  173. package/src/pipeline/stages/tagImage/awsTagImageStage.spec.tsx +62 -107
  174. package/src/routerConsumers.spec.tsx +23 -23
  175. package/src/securityGroup/configure/AmazonSecurityGroupModal.spec.tsx +38 -47
  176. package/src/securityGroup/details/AmazonSecurityGroupDetails.spec.tsx +7 -6
  177. package/src/serverGroup/configure/AmazonImageSelectInput.spec.tsx +47 -65
  178. package/src/serverGroup/configure/AmazonImageSelectInput.tsx +1 -1
  179. package/src/serverGroup/configure/serverGroupCommandBuilder.aws.service.spec.js +18 -19
  180. package/src/serverGroup/configure/serverGroupCommandBuilder.spec.js +41 -26
  181. package/src/serverGroup/configure/wizard/instanceType/simpleMode/SimpleModeSelector.spec.tsx +52 -75
  182. package/src/serverGroup/configure/wizard/pages/ServerGroupBasicSettings.spec.tsx +1 -1
  183. package/src/serverGroup/configure/wizard/pages/advancedSettings/ServerGroupAdvancedSettingsCommon.spec.tsx +36 -33
  184. package/src/serverGroup/configure/wizard/pages/advancedSettings/ServerGroupAdvancedSettingsCommon.tsx +7 -1
  185. package/src/serverGroup/configure/wizard/securityGroups/SecurityGroupSelector.spec.tsx +2 -2
  186. package/src/serverGroup/details/AmazonServerGroupActions.spec.tsx +79 -67
  187. package/src/serverGroup/details/advancedSettings/EditAsgAdvancedSettingsModal.spec.tsx +78 -66
  188. package/src/serverGroup/details/advancedSettings/EditAsgAdvancedSettingsModal.tsx +23 -6
  189. package/src/serverGroup/details/rollback/AmazonRollbackServerGroupModal.spec.tsx +86 -94
  190. package/src/serverGroup/details/rollback/AmazonRollbackServerGroupModal.tsx +3 -0
  191. package/src/serverGroup/details/scalingPolicy/targetTracking/TargetTrackingAdditionalSettings.tsx +1 -39
  192. package/src/serverGroup/details/scalingPolicy/targetTracking/UpsertTargetTrackingModal.tsx +0 -1
  193. package/src/serverGroup/details/scalingProcesses/ModifyScalingProcessesModal.spec.tsx +5 -5
  194. package/src/serverGroup/details/scheduledActions/EditScheduledActionsModal.spec.tsx +8 -8
  195. package/src/serverGroup/details/sections/AmazonServerGroupMaintenanceActions.spec.tsx +71 -60
  196. package/src/serverGroup/details/sections/InstancesDistributionDetailsSection.spec.tsx +21 -39
  197. package/src/serverGroup/details/sections/LaunchTemplateDetailsSection.spec.tsx +56 -97
  198. package/src/serverGroup/details/securityGroups/EditSecurityGroupsModal.spec.tsx +48 -77
  199. package/src/serverGroup/details/warmPool/ModifyWarmPoolModal.spec.tsx +5 -5
  200. package/src/vpc/VpcReader.spec.ts +1 -1
  201. package/src/vpc/VpcTag.spec.tsx +11 -15
  202. /package/dist/{amazon.logo352d4e042476837f.svg → amazon.logoBzC5E-3F.svg} +0 -0
@@ -1,11 +1,14 @@
1
- import { shallow } from 'enzyme';
1
+ import { render, screen } from '@testing-library/react';
2
+ import { hashLocationPlugin, servicesPlugin, UIRouterContext, UIRouterReact, UIViewContext } from '@uirouter/react';
2
3
  import React from 'react';
3
4
 
5
+ import { AccountService } from '@spinnaker/core';
4
6
  import { mockInstance } from '@spinnaker/mocks';
5
7
 
6
8
  import { InstanceInformation } from './InstanceInformation';
7
9
 
8
10
  describe('InstanceInformation', () => {
11
+ let router: UIRouterReact;
9
12
  const testInstance = {
10
13
  ...mockInstance,
11
14
  instanceType: 'm5.large',
@@ -14,8 +17,36 @@ describe('InstanceInformation', () => {
14
17
  serverGroup: 'test_sg',
15
18
  };
16
19
 
20
+ const expectValue = (label: string, value: string) => {
21
+ const term = screen.getByText(label, { selector: 'dt' });
22
+ expect(term.nextElementSibling).toHaveTextContent(value);
23
+ };
24
+
25
+ const renderInformation = (component: React.ReactElement) =>
26
+ render(
27
+ <UIRouterContext.Provider value={router}>
28
+ <UIViewContext.Provider
29
+ value={{ fqn: 'application.instance', context: router.stateRegistry.get('application.instance') as any }}
30
+ >
31
+ {component}
32
+ </UIViewContext.Provider>
33
+ </UIRouterContext.Provider>,
34
+ );
35
+
36
+ beforeEach(() => {
37
+ vi.spyOn(AccountService, 'challengeDestructiveActions').mockResolvedValue(false);
38
+ router = new UIRouterReact();
39
+ router.plugin(servicesPlugin);
40
+ router.plugin(hashLocationPlugin);
41
+ ['application', 'application.instance', 'application.serverGroup'].forEach((name) =>
42
+ router.stateRegistry.register({ name, url: `/${name.split('.').pop()}` }),
43
+ );
44
+ });
45
+
46
+ afterEach(() => router.dispose());
47
+
17
48
  it('should render correct state when all attributes exist', () => {
18
- const wrapper = shallow(
49
+ renderInformation(
19
50
  <InstanceInformation
20
51
  account={testInstance.account}
21
52
  availabilityZone={testInstance.availabilityZone}
@@ -29,22 +60,15 @@ describe('InstanceInformation', () => {
29
60
  />,
30
61
  );
31
62
 
32
- const labeledValues = wrapper.find('LabeledValue');
33
- expect(labeledValues.length).toEqual(5);
34
-
35
- expect(wrapper.childAt(0).prop('label')).toEqual('Launched');
36
- expect(wrapper.childAt(1).prop('label')).toEqual('In');
37
- expect(wrapper.childAt(2).prop('label')).toEqual('Type');
38
- expect(wrapper.childAt(3).prop('label')).toEqual('Capacity Type');
39
- expect(wrapper.childAt(4).prop('label')).toEqual('Server Group');
40
-
41
- expect(wrapper.childAt(0).prop('value')).toEqual('1970-01-14 22:37:37 PST');
42
- expect(wrapper.childAt(2).prop('value')).toEqual(testInstance.instanceType);
43
- expect(wrapper.childAt(3).prop('value')).toEqual(testInstance.capacityType);
63
+ expectValue('Launched', '1970-01-14 22:37:37 PST');
64
+ expectValue('In', testInstance.availabilityZone);
65
+ expectValue('Type', testInstance.instanceType);
66
+ expectValue('Capacity Type', testInstance.capacityType);
67
+ expect(screen.getByRole('link', { name: testInstance.serverGroup })).toBeInTheDocument();
44
68
  });
45
69
 
46
70
  it('should render correct state when attributes are missing', () => {
47
- const wrapper = shallow(
71
+ renderInformation(
48
72
  <InstanceInformation
49
73
  account={testInstance.account}
50
74
  availabilityZone={undefined}
@@ -58,14 +82,10 @@ describe('InstanceInformation', () => {
58
82
  />,
59
83
  );
60
84
 
61
- const labeledValues = wrapper.find('LabeledValue');
62
- expect(labeledValues.length).toEqual(3);
63
-
64
- expect(wrapper.childAt(0).prop('label')).toEqual('Launched');
65
- expect(wrapper.childAt(1).prop('label')).toEqual('In');
66
- expect(wrapper.childAt(2).prop('label')).toEqual('Type');
67
-
68
- expect(wrapper.childAt(0).prop('value')).toEqual('Unknown');
69
- expect(wrapper.childAt(2).prop('value')).toEqual('Unknown');
85
+ expectValue('Launched', 'Unknown');
86
+ expectValue('In', 'Unknown');
87
+ expectValue('Type', 'Unknown');
88
+ expect(screen.queryByText('Capacity Type', { selector: 'dt' })).not.toBeInTheDocument();
89
+ expect(screen.queryByText('Server Group', { selector: 'dt' })).not.toBeInTheDocument();
70
90
  });
71
91
  });
@@ -4,7 +4,7 @@ describe('AmazonLoadBalancersTag', () => {
4
4
  it('opens load balancer and target group details through the injected state service', () => {
5
5
  const stateService = {
6
6
  current: { name: 'home.applications.application.insight.clusters' },
7
- go: jasmine.createSpy('go'),
7
+ go: vi.fn(),
8
8
  };
9
9
  const component = new AmazonLoadBalancersTagComponent({
10
10
  application: {},
@@ -4,7 +4,7 @@ describe('TargetGroupDetails', () => {
4
4
  let stateService: any;
5
5
 
6
6
  beforeEach(() => {
7
- stateService = { params: {}, go: jasmine.createSpy('go') };
7
+ stateService = { params: {}, go: vi.fn() };
8
8
  });
9
9
 
10
10
  function buildComponent(loadBalancers: any[]): TargetGroupDetails {
@@ -64,7 +64,7 @@ describe('TargetGroupDetails', () => {
64
64
  targetGroups: [{ name: 'test-target-group' }],
65
65
  },
66
66
  ]);
67
- spyOn(component, 'setState');
67
+ vi.spyOn(component, 'setState').mockReturnValue(undefined);
68
68
 
69
69
  component.componentWillUnmount();
70
70
  (component as any).extractTargetGroup();
@@ -84,8 +84,8 @@ describe('TargetGroupDetails', () => {
84
84
  const app = {
85
85
  getDataSource: () => ({
86
86
  data: [],
87
- ready: jasmine.createSpy('ready').and.returnValue(rejectedReadiness),
88
- onRefresh: jasmine.createSpy('onRefresh'),
87
+ ready: vi.fn().mockReturnValue(rejectedReadiness),
88
+ onRefresh: vi.fn(),
89
89
  }),
90
90
  } as any;
91
91
  const component = new TargetGroupDetails({
@@ -104,7 +104,7 @@ describe('TargetGroupDetails', () => {
104
104
  region: 'us-west-2',
105
105
  },
106
106
  });
107
- spyOn(component, 'setState');
107
+ vi.spyOn(component, 'setState').mockReturnValue(undefined);
108
108
 
109
109
  component.componentDidMount();
110
110
 
@@ -35,7 +35,7 @@ export class TargetGroups
35
35
  implements IWizardPageComponent<IAmazonApplicationLoadBalancerUpsertCommand> {
36
36
  public protocols = ['HTTP', 'HTTPS'];
37
37
  public targetTypes = ['instance', 'ip', 'lambda'];
38
- private destroy$ = new Subject();
38
+ private destroy$ = new Subject<void>();
39
39
 
40
40
  constructor(props: ITargetGroupsProps) {
41
41
  super(props);
@@ -4,7 +4,7 @@ import { SecurityGroups } from './SecurityGroups';
4
4
 
5
5
  describe('SecurityGroups', () => {
6
6
  it('renders when the security group cache has not been registered', () => {
7
- spyOn(InfrastructureCaches, 'get').and.returnValue(undefined);
7
+ vi.spyOn(InfrastructureCaches, 'get').mockReturnValue(undefined);
8
8
 
9
9
  expect(() => new SecurityGroups(buildProps() as any)).not.toThrow();
10
10
  });
@@ -19,9 +19,9 @@ function buildProps() {
19
19
  securityGroups: [],
20
20
  vpcId: 'vpc-1',
21
21
  },
22
- setFieldValue: jasmine.createSpy('setFieldValue'),
23
- validateForm: jasmine.createSpy('validateForm'),
22
+ setFieldValue: vi.fn(),
23
+ validateForm: vi.fn(),
24
24
  },
25
- onLoadingChanged: jasmine.createSpy('onLoadingChanged'),
25
+ onLoadingChanged: vi.fn(),
26
26
  };
27
27
  }
@@ -37,7 +37,7 @@ export class TargetGroups
37
37
  public protocols = ['TCP', 'UDP'];
38
38
  public healthProtocols = ['TCP', 'HTTP', 'HTTPS'];
39
39
  public targetTypes = ['instance', 'ip'];
40
- private destroy$ = new Subject();
40
+ private destroy$ = new Subject<void>();
41
41
 
42
42
  constructor(props: ITargetGroupsProps) {
43
43
  super(props);
@@ -1,32 +1,25 @@
1
- import { mount as enzymeMount, ReactWrapper } from 'enzyme';
1
+ import { act, waitFor } from '@testing-library/react';
2
2
  import React from 'react';
3
- import { act } from 'react-dom/test-utils';
4
3
  import { BehaviorSubject } from 'rxjs';
5
4
 
6
5
  import { DeckRuntimeContext } from '@spinnaker/core';
6
+ import { renderHookHarness } from '../../../../core/src/utils/testUtils/hookHarness';
7
7
 
8
8
  import { useAmazonLoadBalancerDetails } from './amazonLoadBalancerDetails';
9
9
  import { RequestBuilder } from '../../../../core/src/api/ApiService';
10
10
 
11
11
  describe('useAmazonLoadBalancerDetails', () => {
12
- const flush = () => new Promise((resolve) => setTimeout(resolve, 0));
13
12
  const defaultHttpClient = RequestBuilder.defaultHttpClient;
14
- let wrapper: ReactWrapper | undefined;
15
13
  let runtimeServices: any;
16
14
  const RuntimeWrapper = ({ children }: React.PropsWithChildren<{}>) => (
17
15
  <DeckRuntimeContext.Provider value={{ services: runtimeServices } as any}>{children}</DeckRuntimeContext.Provider>
18
16
  );
19
- const mount = (component: React.ReactElement) => enzymeMount(component, { wrappingComponent: RuntimeWrapper });
20
17
 
21
18
  beforeEach(() => {
22
19
  runtimeServices = {};
23
20
  });
24
21
 
25
22
  afterEach(() => {
26
- if (wrapper) {
27
- wrapper.unmount();
28
- wrapper = undefined;
29
- }
30
23
  RequestBuilder.defaultHttpClient = defaultHttpClient;
31
24
  });
32
25
 
@@ -46,36 +39,25 @@ describe('useAmazonLoadBalancerDetails', () => {
46
39
  data: [loadBalancer],
47
40
  });
48
41
  const app = {
49
- getDataSource: jasmine.createSpy('getDataSource').and.returnValue({
42
+ getDataSource: vi.fn().mockReturnValue({
50
43
  status$,
51
- refresh: jasmine.createSpy('refresh'),
44
+ refresh: vi.fn(),
52
45
  }),
53
46
  } as any;
54
- const get = jasmine.createSpy('get').and.returnValue(new Promise(() => undefined));
47
+ const get = vi.fn().mockReturnValue(new Promise(() => undefined));
55
48
  RequestBuilder.defaultHttpClient = { get } as any;
56
49
  runtimeServices.securityGroupReader = {
57
- getApplicationSecurityGroup: jasmine.createSpy('getApplicationSecurityGroup'),
50
+ getApplicationSecurityGroup: vi.fn(),
58
51
  };
59
52
 
60
- function TestComponent() {
61
- useAmazonLoadBalancerDetails({
62
- app,
63
- loadBalancerParams: { accountId: 'test', name: 'frontend', provider: 'aws', region: 'us-east-1' },
64
- autoClose: () => undefined,
65
- } as any);
66
- return null;
67
- }
68
-
69
- await act(async () => {
70
- wrapper = mount(<TestComponent />);
71
- await flush();
72
- });
73
- wrapper.update();
74
-
75
- await act(async () => {
76
- await flush();
77
- });
78
- wrapper.update();
53
+ const props = {
54
+ app,
55
+ loadBalancerParams: { accountId: 'test', name: 'frontend', provider: 'aws', region: 'us-east-1' },
56
+ autoClose: () => undefined,
57
+ } as any;
58
+ const hook = renderHookHarness(useAmazonLoadBalancerDetails, props, { wrapper: RuntimeWrapper });
59
+ await waitFor(() => expect(get).toHaveBeenCalledTimes(1));
60
+ hook.rerenderHook({ ...props, autoClose: () => undefined });
79
61
 
80
62
  expect(get).toHaveBeenCalledTimes(1);
81
63
  });
@@ -96,46 +78,42 @@ describe('useAmazonLoadBalancerDetails', () => {
96
78
  data: [loadBalancer],
97
79
  });
98
80
  const app = {
99
- getDataSource: jasmine.createSpy('getDataSource').and.returnValue({
81
+ getDataSource: vi.fn().mockReturnValue({
100
82
  status$,
101
- refresh: jasmine.createSpy('refresh'),
83
+ refresh: vi.fn(),
102
84
  }),
103
85
  } as any;
104
86
  let resolveDetails: (details: any[]) => void = () => undefined;
105
87
  const detailsRequest = new Promise<any[]>((resolve) => {
106
88
  resolveDetails = resolve;
107
89
  });
108
- const get = jasmine.createSpy('get').and.returnValue(detailsRequest);
109
- const consoleError = spyOn(console, 'error');
90
+ const get = vi.fn().mockReturnValue(detailsRequest);
91
+ const consoleError = vi.spyOn(console, 'error').mockReturnValue(undefined);
110
92
  RequestBuilder.defaultHttpClient = { get } as any;
111
93
  runtimeServices.securityGroupReader = {
112
- getApplicationSecurityGroup: jasmine.createSpy('getApplicationSecurityGroup'),
94
+ getApplicationSecurityGroup: vi.fn(),
113
95
  };
114
96
 
115
- function TestComponent() {
116
- useAmazonLoadBalancerDetails({
97
+ const hook = renderHookHarness(
98
+ useAmazonLoadBalancerDetails,
99
+ {
117
100
  app,
118
101
  loadBalancerParams: { accountId: 'test', name: 'frontend', provider: 'aws', region: 'us-east-1' },
119
102
  autoClose: () => undefined,
120
- } as any);
121
- return null;
122
- }
123
-
124
- await act(async () => {
125
- wrapper = mount(<TestComponent />);
126
- await flush();
127
- });
128
- wrapper.unmount();
129
- wrapper = undefined;
103
+ } as any,
104
+ { wrapper: RuntimeWrapper },
105
+ );
106
+ await waitFor(() => expect(get).toHaveBeenCalledTimes(1));
107
+ hook.unmount();
130
108
 
131
109
  await act(async () => {
132
110
  resolveDetails([]);
133
- await flush();
111
+ await detailsRequest;
134
112
  });
135
113
 
136
- const unmountedStateUpdateWarning = consoleError.calls
137
- .allArgs()
138
- .some(([message]) => String(message).includes('unmounted component'));
114
+ const unmountedStateUpdateWarning = consoleError.mock.calls.some(([message]) =>
115
+ String(message).includes('unmounted component'),
116
+ );
139
117
  expect(unmountedStateUpdateWarning).toBe(false);
140
118
  });
141
119
  });
@@ -1,29 +1,27 @@
1
- import { mount } from 'enzyme';
1
+ import { act, render, screen, waitFor, within } from '@testing-library/react';
2
2
  import React from 'react';
3
+ import type { Mock } from 'vitest';
4
+
3
5
  import { AccountService } from '@spinnaker/core';
4
6
 
5
7
  import { AmazonStageConfig, getAmazonStageFields } from './AmazonStageConfig';
8
+ import { getFormGroupByLabel } from '../../../../core/src/utils/testUtils/rtl';
6
9
 
7
10
  describe('AmazonStageConfig', () => {
8
11
  beforeEach(() => {
9
- spyOn(AccountService, 'listAccounts').and.returnValue(Promise.resolve([{ name: 'test', type: 'aws' }] as any));
10
- spyOn(AccountService, 'getUniqueAttributeForAllAccounts').and.returnValue(Promise.resolve(['us-east-1']) as any);
11
- spyOn(AccountService, 'getAllAccountDetailsForProvider').and.returnValue(Promise.resolve([]) as any);
12
+ vi.spyOn(AccountService, 'listAccounts').mockResolvedValue([{ name: 'test', type: 'aws' }] as any);
13
+ vi.spyOn(AccountService, 'getUniqueAttributeForAllAccounts').mockResolvedValue(['us-east-1'] as any);
14
+ vi.spyOn(AccountService, 'getAllAccountDetailsForProvider').mockResolvedValue([] as any);
12
15
  });
13
16
 
14
- function renderStage(stage: any = {}) {
15
- const application = {
16
- defaultCredentials: {},
17
- defaultRegions: {},
18
- getDataSource: () => ({ data: [] }),
19
- };
20
-
21
- return mount(
17
+ function renderStage(stageOverrides: any = {}) {
18
+ const application = { defaultCredentials: {}, defaultRegions: {}, getDataSource: () => ({ data: [] }) };
19
+ return render(
22
20
  <AmazonStageConfig
23
21
  application={application as any}
24
22
  pipeline={{} as any}
25
- stage={{ type: 'destroyServerGroup', cloudProviderType: 'aws', ...stage }}
26
- updateStageField={jasmine.createSpy('updateStageField') as any}
23
+ stage={{ type: 'destroyServerGroup', cloudProviderType: 'aws', ...stageOverrides }}
24
+ updateStageField={vi.fn() as any}
27
25
  />,
28
26
  );
29
27
  }
@@ -50,53 +48,46 @@ describe('AmazonStageConfig', () => {
50
48
  'upsertImageTags',
51
49
  ];
52
50
  const fallbackFields = getAmazonStageFields({ type: 'unknown' });
53
- const genericStageTypes = [...simpleStageTypes, ...dedicatedStageTypes].filter(
54
- (type) => getAmazonStageFields({ type }) !== fallbackFields,
55
- );
56
51
 
57
- expect(genericStageTypes).toEqual(simpleStageTypes);
52
+ expect(
53
+ [...simpleStageTypes, ...dedicatedStageTypes].filter((type) => getAmazonStageFields({ type }) !== fallbackFields),
54
+ ).toEqual(simpleStageTypes);
58
55
  });
59
56
 
60
- it('renders account as a selector for target server group stages', () => {
61
- const wrapper = renderStage({ credentials: 'test' });
57
+ it('renders account as a selector for target server group stages', async () => {
58
+ renderStage({ credentials: 'test' });
62
59
 
63
- expect(wrapper.find('select[name="credentials"]').exists()).toBe(true);
64
- expect(wrapper.find('input[name="credentials"]').exists()).toBe(false);
60
+ await waitFor(() => expect(within(getFormGroupByLabel('Account')).getByRole('combobox')).toHaveValue('test'));
61
+ expect(within(getFormGroupByLabel('Account')).queryByRole('textbox')).not.toBeInTheDocument();
65
62
  });
66
63
 
67
- it('keeps server group target as a selector', () => {
68
- const wrapper = renderStage({ target: 'current_asg' });
64
+ it('keeps server group target as a selector', async () => {
65
+ renderStage({ target: 'current_asg' });
69
66
 
70
- expect(
71
- wrapper
72
- .find('select')
73
- .filterWhere((node) => node.find('option[value="current_asg"]').exists())
74
- .exists(),
75
- ).toBe(true);
67
+ await waitFor(() =>
68
+ expect(within(getFormGroupByLabel('Server Group')).getByRole('combobox')).toHaveValue('current_asg'),
69
+ );
70
+ expect(screen.getByRole('option', { name: /current/i })).toHaveAttribute('value', 'current_asg');
76
71
  });
77
72
 
78
73
  it('does not update account and region state after unmount', async () => {
79
74
  let resolveAccounts: (accounts: any[]) => void;
80
75
  let resolveRegions: (regions: string[]) => void;
81
- (AccountService.listAccounts as jasmine.Spy).and.returnValue(
82
- new Promise((resolve) => {
83
- resolveAccounts = resolve;
84
- }) as any,
85
- );
86
- (AccountService.getUniqueAttributeForAllAccounts as jasmine.Spy).and.returnValue(
87
- new Promise((resolve) => {
88
- resolveRegions = resolve;
89
- }) as any,
76
+ (AccountService.listAccounts as Mock).mockReturnValue(new Promise((resolve) => (resolveAccounts = resolve)) as any);
77
+ (AccountService.getUniqueAttributeForAllAccounts as Mock).mockReturnValue(
78
+ new Promise((resolve) => (resolveRegions = resolve)) as any,
90
79
  );
91
- spyOn(console, 'error');
80
+ const consoleError = vi.spyOn(console, 'error').mockReturnValue(undefined);
81
+ const rendered = renderStage();
82
+ rendered.unmount();
92
83
 
93
- const wrapper = renderStage();
94
- wrapper.unmount();
95
- resolveAccounts!([{ name: 'test', type: 'aws' }]);
96
- resolveRegions!(['us-east-1']);
97
- await Promise.resolve();
84
+ await act(async () => {
85
+ resolveAccounts!([{ name: 'test', type: 'aws' }]);
86
+ resolveRegions!(['us-east-1']);
87
+ await Promise.resolve();
88
+ });
98
89
 
99
- expect((console.error as jasmine.Spy).calls.allArgs().join('\n')).not.toContain(
90
+ expect(consoleError.mock.calls.join('\n')).not.toContain(
100
91
  "Can't perform a React state update on an unmounted component",
101
92
  );
102
93
  });
@@ -202,6 +202,7 @@ export function DeployCloudFormationStackStageConfig({
202
202
 
203
203
  {source === 'text' && (
204
204
  <YamlEditor
205
+ ariaLabel="CloudFormation template YAML"
205
206
  onChange={(raw, templateBody) => {
206
207
  setTemplateEditorState({ refId: stage.refId, rawTemplateBody: raw });
207
208
  if (templateBody !== null) {