<tab i18n-heading
heading="Details">
<cd-table-key-value [renderObjects]="true"
- [data]="selection.first()"
+ [data]="filterNonPoolData(selection.first())"
[autoReload]="false">
</cd-table-key-value>
</tab>
expect(tabs[0].active).toBeTruthy();
});
- it('current active status of tabs should not change when selection is same with previour selection', () => {
+ it('current active status of tabs should not change when selection is the same as previous selection', () => {
fixture.detectChanges();
const tabs = poolDetailsComponent.tabsetChild.tabs;
expect(tabs[0].active).toBeTruthy();
fixture.detectChanges();
expect(tabs[1].active).toBeTruthy();
});
+
+ it('returns pool details correctly', () => {
+ const pool = { prop1: 1, cdIsBinary: true, prop2: 2, cdExecuting: true, prop3: 3 };
+ const expectedPool = { prop1: 1, prop2: 2, prop3: 3 };
+
+ expect(poolDetailsComponent.filterNonPoolData(pool)).toEqual(expectedPool);
+ });
+
+ it('pool data filtering is called', () => {
+ const filterNonPoolDataSpy = spyOn(
+ poolDetailsComponent,
+ 'filterNonPoolData'
+ ).and.callThrough();
+
+ fixture.detectChanges();
+
+ expect(filterNonPoolDataSpy).toHaveBeenCalled();
+ });
});
});
import { Component, Input, OnChanges, ViewChild } from '@angular/core';
import { I18n } from '@ngx-translate/i18n-polyfill';
+import * as _ from 'lodash';
import { TabsetComponent } from 'ngx-bootstrap/tabs';
import { PoolService } from '../../../shared/api/pool.service';
});
}
}
+
+ filterNonPoolData(pool: object): object {
+ return _.omit(pool, ['cdExecuting', 'cdIsBinary']);
+ }
}
expect(component.columns.every((column) => Boolean(column.prop))).toBeTruthy();
});
- it('returns pool details correctly', () => {
- const pool = { prop1: 1, cdIsBinary: true, prop2: 2, cdExecuting: true, prop3: 3 };
- const expected = { prop1: 1, prop2: 2, prop3: 3 };
- expect(component.getPoolDetails(pool)).toEqual(expected);
- });
-
describe('monAllowPoolDelete', () => {
let configOptRead: boolean;
let configurationService: ConfigurationService;
return strings.join(', ');
}
- getPoolDetails(pool: object) {
- return _.omit(pool, ['cdExecuting', 'cdIsBinary']);
- }
-
getSelectionTiers() {
const cacheTierIds = this.selection.hasSingleSelection
? this.selection.first()['tiers'] || []