// placement labels take only single value
formHelper.setValue('service_type', 'mgr');
formHelper.setValue('placement', 'label');
- formHelper.setValue('label', "{content: 'foo', selected: true}");
+ formHelper.setValue('label', { content: 'foo', selected: true });
component.onSubmit();
req.flush(mockGroups);
});
- it('should filter hosts by array label placement', (done) => {
- const mockGroups = [
- [{ spec: { group: 'default' }, placement: { hosts: [], label: ['nvmeof', 'storage'] } }]
- ];
- mockHostService.getAllHosts.mockReturnValue(of(allHosts));
-
- service.getHostsForGroup('default').subscribe((hosts: any[]) => {
- expect(hosts.length).toBe(1);
- expect(hosts[0].hostname).toBe('host3');
- done();
- });
-
- const req = httpTesting.expectOne(`${API_PATH}/gateway/group`);
- req.flush(mockGroups);
- });
-
it('should return empty array when group not found', (done) => {
const mockGroups = [
[{ spec: { group: 'other' }, placement: { hosts: ['host1'], label: [] } }]