+import { HttpHeaders } from '@angular/common/http';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
let hostListSpy: jasmine.Spy;
let orchService: OrchestratorService;
let showForceMaintenanceModal: MockShowForceMaintenanceModal;
+ let headers: HttpHeaders;
const fakeAuthStorageService = {
getPermissions: () => {
component = fixture.componentInstance;
hostListSpy = spyOn(TestBed.inject(HostService), 'list');
orchService = TestBed.inject(OrchestratorService);
+ headers = new HttpHeaders().set('x-total-count', '10');
});
it('should create', () => {
}
],
hostname: hostname,
- labels: ['foo', 'bar']
+ labels: ['foo', 'bar'],
+ headers: headers
}
];
OrchestratorHelper.mockStatus(false);
+ fixture.detectChanges();
hostListSpy.and.callFake(() => of(payload));
fixture.detectChanges();
}
],
hostname: hostname,
- labels: ['foo', 'bar']
+ labels: ['foo', 'bar'],
+ headers: headers
}
];
OrchestratorHelper.mockStatus(false);
+ fixture.detectChanges();
hostListSpy.and.callFake(() => of(payload));
fixture.detectChanges();
hdd_capacity_bytes: 1024,
flash_count: 4,
flash_capacity_bytes: 1024,
- nic_count: 1
+ nic_count: 1,
+ headers: headers
}
];
OrchestratorHelper.mockStatus(true, features);
+ fixture.detectChanges();
hostListSpy.and.callFake(() => of(payload));
fixture.detectChanges();
type: 'osd',
id: '0'
}
- ]
+ ],
+ headers: headers
}
];
OrchestratorHelper.mockStatus(false);
+ fixture.detectChanges();
hostListSpy.and.callFake(() => of(payload));
fixture.detectChanges();
type: 'osd',
id: '0'
}
- ]
+ ],
+ headers: headers
}
];
OrchestratorHelper.mockStatus(true);
+ fixture.detectChanges();
hostListSpy.and.callFake(() => of(payload));
fixture.detectChanges();
hdd_capacity_bytes: undefined,
flash_count: 4,
flash_capacity_bytes: undefined,
- nic_count: 1
+ nic_count: 1,
+ headers: headers
}
];
OrchestratorHelper.mockStatus(true, features);
+ fixture.detectChanges();
hostListSpy.and.callFake(() => of(hostPayload));
fixture.detectChanges();
const fakeHosts = require('./fixtures/host_list_response.json');
beforeEach(() => {
- hostListSpy.and.callFake(() => of(fakeHosts));
+ let headers = new HttpHeaders().set('x-total-count', '10');
+ headers = headers.set('x-total-count', '10');
+ fakeHosts[0].headers = headers;
+ fakeHosts[1].headers = headers;
});
const testTableActions = async (
fixture.detectChanges();
await fixture.whenStable();
+ component.getHosts(new CdTableFetchDataContext(() => undefined));
+ hostListSpy.and.callFake(() => of(fakeHosts));
+ fixture.detectChanges();
for (const test of tests) {
if (test.selectRow) {
component.selection = new CdTableSelection();