Update topology-summary.component.spec.ts

This commit is contained in:
piotrpekala7
2020-03-18 11:07:11 +01:00
parent 2b45f7a643
commit a0aa918016

View File

@ -68,7 +68,7 @@ describe('TopologySummaryComponent', () => {
{ status: 'stopped' } as Node { status: 'stopped' } as Node
]; ];
component.applyStatusFilter(true, 'started'); component.applyStatusFilter('started');
expect(component.filteredNodes.length).toBe(1); expect(component.filteredNodes.length).toBe(1);
expect(component.filteredNodes[0].status).toBe('started'); expect(component.filteredNodes[0].status).toBe('started');
@ -80,7 +80,7 @@ describe('TopologySummaryComponent', () => {
{ status: 'stopped' } as Node { status: 'stopped' } as Node
]; ];
component.applyStatusFilter(true, 'stopped'); component.applyStatusFilter('stopped');
expect(component.filteredNodes.length).toBe(1); expect(component.filteredNodes.length).toBe(1);
expect(component.filteredNodes[0].status).toBe('stopped'); expect(component.filteredNodes[0].status).toBe('stopped');
@ -92,7 +92,7 @@ describe('TopologySummaryComponent', () => {
{ status: 'stopped' } as Node { status: 'stopped' } as Node
]; ];
component.applyStatusFilter(true, 'suspended'); component.applyStatusFilter('suspended');
expect(component.filteredNodes.length).toBe(0); expect(component.filteredNodes.length).toBe(0);
}); });
@ -103,9 +103,9 @@ describe('TopologySummaryComponent', () => {
{ status: 'stopped' } as Node { status: 'stopped' } as Node
]; ];
component.applyStatusFilter(true, 'suspended'); component.applyStatusFilter('suspended');
component.applyStatusFilter(true, 'started'); component.applyStatusFilter('started');
component.applyStatusFilter(true, 'stopped'); component.applyStatusFilter('stopped');
expect(component.filteredNodes.length).toBe(2); expect(component.filteredNodes.length).toBe(2);
}); });
@ -116,18 +116,18 @@ describe('TopologySummaryComponent', () => {
{ status: 'stopped' } as Node { status: 'stopped' } as Node
]; ];
component.applyStatusFilter(true, 'suspended'); component.applyStatusFilter('suspended');
component.applyStatusFilter(true, 'started'); component.applyStatusFilter('started');
component.applyStatusFilter(true, 'stopped'); component.applyStatusFilter('stopped');
expect(component.filteredNodes.length).toBe(2); expect(component.filteredNodes.length).toBe(2);
component.applyStatusFilter(false, 'stopped'); component.applyStatusFilter('stopped');
expect(component.filteredNodes.length).toBe(1); expect(component.filteredNodes.length).toBe(1);
component.applyStatusFilter(false, 'suspended'); component.applyStatusFilter('suspended');
component.applyStatusFilter(false, 'started'); component.applyStatusFilter('started');
expect(component.filteredNodes.length).toBe(2); expect(component.filteredNodes.length).toBe(2);
}); });
@ -138,9 +138,10 @@ describe('TopologySummaryComponent', () => {
{ status: 'stopped', name: 'B' } as Node, { status: 'stopped', name: 'B' } as Node,
{ status: 'stopped', name: 'D' } as Node, { status: 'stopped', name: 'D' } as Node,
]; ];
component.sortingOrder = 'asc';
component.applyFilters(); component.applyFilters();
component.setSortingOrder('asc'); component.setSortingOrder();
expect(component.filteredNodes[0].name).toBe('A'); expect(component.filteredNodes[0].name).toBe('A');
}); });
@ -151,9 +152,10 @@ describe('TopologySummaryComponent', () => {
{ status: 'stopped', name: 'B' } as Node, { status: 'stopped', name: 'B' } as Node,
{ status: 'stopped', name: 'D' } as Node, { status: 'stopped', name: 'D' } as Node,
]; ];
component.sortingOrder = 'desc';
component.applyStatusFilter(true, 'stopped'); component.applyStatusFilter('stopped');
component.setSortingOrder('desc'); component.setSortingOrder();
expect(component.filteredNodes[0].name).toBe('D'); expect(component.filteredNodes[0].name).toBe('D');
}); });