Skip to content

Commit

Permalink
fix(core/serverGroup): Correct 'simple scaling' heuristic (#7385)
Browse files Browse the repository at this point in the history
* fix(core/serverGroup): Correct 'simple scaling' heuristic

This was seemingly introduced from 6630f9b

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
  • Loading branch information
danopia authored and kevinawoo committed Oct 2, 2019
1 parent f957d42 commit ee18eb0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import * as React from 'react';
import { mount } from 'enzyme';

import { CapacityDetailsSection } from './CapacityDetailsSection';

describe('<CapacityDetailsSection/>', function () {
it('when min === max, it should be displayed in simplemode', function () {
const component = mount(<CapacityDetailsSection capacity={{ min: 9, max: 9, desired: 4 }} current={5}/>);
expect(component.contains(<dt>Min/Max</dt>)).toBe(true);
});

it('when min !== max, it should display the different min and max separately', function () {
const component = mount(<CapacityDetailsSection capacity={{ min: 1, max: 9, desired: 4 }} current={5}/>);
expect(component.contains(<dt>Min</dt>)).toBe(true);
expect(component.contains(<dt>Max</dt>)).toBe(true);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<dl className="dl-horizontal dl-flex">
<DesiredCapacity capacity={capacity} simpleMode={simpleMode} />
Expand Down

0 comments on commit ee18eb0

Please sign in to comment.