Skip to content

Commit

Permalink
upcoming: [DI-20928] - Destructure properties from objects and use
Browse files Browse the repository at this point in the history
  • Loading branch information
vmangalr committed Oct 17, 2024
1 parent c431f17 commit 0332671
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ it('test getRegionProperties method', () => {
},
vi.fn()
);
const { name } = regionConfig.configuration;
expect(handleRegionChange).toBeDefined();
expect(selectedDashboard).toEqual(mockDashboard);
expect(label).toEqual(regionConfig.configuration.name);
expect(label).toEqual(name);
}
});

Expand All @@ -69,9 +70,10 @@ it('test getTimeDuratonProperties method', () => {
},
vi.fn()
);
const { name } = timeDurationConfig.configuration;
expect(handleStatsChange).toBeDefined();
expect(savePreferences).toEqual(true);
expect(label).toEqual(timeDurationConfig.configuration.name);
expect(label).toEqual(name);
}
});

Expand All @@ -98,11 +100,12 @@ it('test getResourceSelectionProperties method', () => {
},
vi.fn()
);
const { name } = resourceSelectionConfig.configuration;
expect(handleResourcesSelection).toBeDefined();
expect(savePreferences).toEqual(false);
expect(disabled).toEqual(false);
expect(JSON.stringify(xFilter)).toEqual('{"+and":[{"region":"us-east"}]}');
expect(label).toEqual(resourceSelectionConfig.configuration.name);
expect(label).toEqual(name);
}
});

Expand All @@ -129,11 +132,12 @@ it('test getResourceSelectionProperties method with disabled true', () => {
},
vi.fn()
);
const { name } = resourceSelectionConfig.configuration;
expect(handleResourcesSelection).toBeDefined();
expect(savePreferences).toEqual(false);
expect(disabled).toEqual(true);
expect(JSON.stringify(xFilter)).toEqual('{"+and":[]}');
expect(label).toEqual(resourceSelectionConfig.configuration.name);
expect(label).toEqual(name);
}
});

Expand Down Expand Up @@ -268,11 +272,13 @@ it('test getCustomSelectProperties method', () => {
vi.fn()
);

const { name } = customSelectEngineConfig.configuration;

expect(apiV4QueryKey).toEqual(databaseQueries.engines);
expect(type).toEqual(CloudPulseSelectTypes.dynamic);
expect(savePreferencesApi).toEqual(false);
expect(isMultiSelectApi).toEqual(true);
expect(label).toEqual(customSelectEngineConfig.configuration.name);
expect(label).toEqual(name);
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ describe('CloudPulseRegionSelect', () => {
const { getByLabelText, getByTestId } = renderWithTheme(
<CloudPulseRegionSelect {...props} />
);
expect(getByLabelText(props.label)).toBeInTheDocument();
const { label } = props;
expect(getByLabelText(label)).toBeInTheDocument();
expect(getByTestId('region-select')).toBeInTheDocument();
});
});

0 comments on commit 0332671

Please sign in to comment.