Merged PR 55: Fix bug with neg. skip and update remi library to handle missing required-capacities result

+ Package Update ISA Remi Library to 0.3.12
+ Set Skip on fetch last products to minimum 0

Related work items: #467
This commit is contained in:
Sebastian Neumair
2020-04-23 08:56:14 +00:00
committed by Lorenz Hilpert
4 changed files with 21 additions and 6 deletions

View File

@@ -1,6 +1,7 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { RemissionListComponent } from './remission-list.component';
import { of } from 'rxjs';
describe('RemissionListComponent', () => {
let component: RemissionListComponent;
@@ -15,6 +16,20 @@ describe('RemissionListComponent', () => {
beforeEach(() => {
fixture = TestBed.createComponent(RemissionListComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
describe('subscribeToFetchLastProducts', () => {
component.pageSize = 10;
component.totalHits = 9
component.products = []
it('should call fetchProductsBySkipAndTake', () => {
spyOn(component, 'fetchProductsBySkipAndTake').and.callFake(() => of())
component.fetchLastProducts$.next()
fixture.detectChanges()
expect(component.fetchProductsBySkipAndTake).toHaveBeenCalledWith(0, 10)
})
})
});

View File

@@ -107,7 +107,7 @@ export class RemissionListComponent implements OnInit, OnDestroy {
this.fetchLastProducts$.pipe(takeUntil(this.destroy$)).subscribe(_ => {
// Increase number of takes to show all residual products (currently: 10)
const takeParam = this.pageSize;
const skipParam = this.totalHits - takeParam;
const skipParam = Math.max(0, this.totalHits - takeParam);
if (
this.products.length >

6
package-lock.json generated
View File

@@ -1095,9 +1095,9 @@
}
},
"@isa/remission": {
"version": "0.3.11",
"resolved": "https://pkgs.dev.azure.com/hugendubel/_packaging/hugendubel/npm/registry/@isa/remission/-/remission-0.3.11.tgz",
"integrity": "sha1-7UuRwZHJvh8K8dXE0zJRDPBrotc=",
"version": "0.3.12",
"resolved": "https://pkgs.dev.azure.com/hugendubel/_packaging/hugendubel/npm/registry/@isa/remission/-/remission-0.3.12.tgz",
"integrity": "sha1-G8wLRnJjfAS18j+I7+AxB2T8Vl0=",
"requires": {
"tslib": "^1.9.0"
}

View File

@@ -38,7 +38,7 @@
"@isa/catsearch-api": "^0.0.53",
"@isa/print-api": "0.0.53",
"@isa/remi-api": "^0.0.53",
"@isa/remission": "^0.3.11",
"@isa/remission": "^0.3.12",
"@ng-idle/core": "^8.0.0-beta.4",
"@ng-idle/keepalive": "^8.0.0-beta.4",
"@ngxs/store": "^3.4.1",