From ee18eb0445736fb24a1b086a68384f5f0734010a Mon Sep 17 00:00:00 2001 From: Daniel Lamando Date: Wed, 2 Oct 2019 10:43:47 +0200 Subject: [PATCH] fix(core/serverGroup): Correct 'simple scaling' heuristic (#7385) * fix(core/serverGroup): Correct 'simple scaling' heuristic This was seemingly introduced from 6630f9bca7bd17e99bafa174b7659bc6c63f79fd The regression is that the "Capacity" section always considers the scaling mode to be "simple", and doesn't show the actual min/max capacity numbers, only Desired. Noticed using an AWS account. * fix(core/serverGroup): Adding test for capacity details --- .../capacity/CapacityDetailsSection.spec.tsx | 17 +++++++++++++++++ .../details/capacity/CapacityDetailsSection.tsx | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 app/scripts/modules/core/src/serverGroup/details/capacity/CapacityDetailsSection.spec.tsx diff --git a/app/scripts/modules/core/src/serverGroup/details/capacity/CapacityDetailsSection.spec.tsx b/app/scripts/modules/core/src/serverGroup/details/capacity/CapacityDetailsSection.spec.tsx new file mode 100644 index 00000000000..b3686ef0701 --- /dev/null +++ b/app/scripts/modules/core/src/serverGroup/details/capacity/CapacityDetailsSection.spec.tsx @@ -0,0 +1,17 @@ +import * as React from 'react'; +import { mount } from 'enzyme'; + +import { CapacityDetailsSection } from './CapacityDetailsSection'; + +describe('', function () { + it('when min === max, it should be displayed in simplemode', function () { + const component = mount(); + expect(component.contains(
Min/Max
)).toBe(true); + }); + + it('when min !== max, it should display the different min and max separately', function () { + const component = mount(); + expect(component.contains(
Min
)).toBe(true); + expect(component.contains(
Max
)).toBe(true); + }); +}); diff --git a/app/scripts/modules/core/src/serverGroup/details/capacity/CapacityDetailsSection.tsx b/app/scripts/modules/core/src/serverGroup/details/capacity/CapacityDetailsSection.tsx index 0f941195e51..673c845ad34 100644 --- a/app/scripts/modules/core/src/serverGroup/details/capacity/CapacityDetailsSection.tsx +++ b/app/scripts/modules/core/src/serverGroup/details/capacity/CapacityDetailsSection.tsx @@ -11,7 +11,7 @@ interface ICapacityDetailsSectionProps { export function CapacityDetailsSection(props: ICapacityDetailsSectionProps) { const { capacity, current } = props; - const simpleMode = capacity.max === capacity.max; + const simpleMode = capacity.min === capacity.max; return (