+/*-
+ * ========================LICENSE_START=================================
+ * O-RAN-SC
+ * %%
+ * Copyright (C) 2021-2022 Nordix Foundation
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ========================LICENSE_END===================================
+ */
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
} as Producer;
setServiceSpy();
+
component.loadProducers();
const actualProducers: Producer[] = component.producers();
+ expect(actualProducers.length).toEqual(2);
expect(actualProducers).toEqual([producer1, producer2]);
});
it('should contain data after initialization', async () => {
setServiceSpy();
- component.ngOnInit();
const expectedProducerRows = [
expectedProducer1Row,
{ id: 'producer2', types: 'type2,type3', status: 'DISABLED' }
producerServiceSpy.getProducer.and.returnValues(of({} as ProducerRegistrationInfo));
producerServiceSpy.getProducerStatus.and.returnValues(of({} as ProducerStatus));
- component.ngOnInit();
const expectedProducerRow = { id: 'producer1', types: '< No types >', status: '< No status >' };
+
let producersTable = await loader.getHarness(MatTableHarness.with({ selector: '#producersTable' }));
let producerRows = await producersTable.getRows();
expect(await producerRows[0].getCellTextByColumnName()).toEqual(expectedProducerRow);
it('filtering', async () => {
setServiceSpy();
- component.ngOnInit();
let producersTable = await loader.getHarness(MatTableHarness.with({ selector: '#producersTable' }));
let idFilterInput = await loader.getHarness(MatInputHarness.with({ selector: '#producerIdFilter' }));