Skip to content

Commit

Permalink
Refactored icon util and changed test description
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitkrai03 committed Dec 17, 2019
1 parent 730dfc6 commit f35946a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 4 additions & 6 deletions frontend/packages/console-shared/src/utils/icon-utils.ts
@@ -1,9 +1,7 @@
import * as _ from 'lodash';
import * as operatorLogo from '../images/operator.svg';

export const getImageForCSVIcon = (csv) =>
_.get(csv, 'spec.icon')
? `data:${_.get(csv, 'spec.icon', [])[0].mediatype};base64,${
_.get(csv, 'spec.icon', [])[0].base64data
}`
: operatorLogo;
export const getImageForCSVIcon = (csv) => {
const icon = _.get(csv, 'spec.icon', []);
return !_.isEmpty(icon) ? `data:${icon[0].mediatype};base64,${icon[0].base64data}` : operatorLogo;
};
Expand Up @@ -230,7 +230,7 @@ describe('TopologyUtils ', () => {
expect((topologyTransformedData[keys[0]].data as WorkloadData).builderImage).toBe(nodejsIcon);
});

it('should return builder image icon for nodejs', () => {
it('should return csv icon for operator backed service', () => {
const csvIcon = getImageForCSVIcon(MockResources.clusterServiceVersions.data[0]);
const { topologyTransformedData, keys } = getTranformedTopologyData(MockResources, [
'deployments',
Expand Down

0 comments on commit f35946a

Please sign in to comment.