Fix tests

PaginationComponent: expected arguments of updateRoute were out of sync with (fixed) types
GroupFormComponent:  groupBeingEdited is never set to null
This commit is contained in:
Yury Bondarenko
2023-06-28 09:36:44 +02:00
parent 0633460107
commit 2cad56c51f
2 changed files with 7 additions and 7 deletions

View File

@@ -39,8 +39,8 @@
<button (click)="onCancel()" <button (click)="onCancel()"
class="btn btn-outline-secondary"><i class="fas fa-arrow-left"></i> {{messagePrefix + '.return' | translate}}</button> class="btn btn-outline-secondary"><i class="fas fa-arrow-left"></i> {{messagePrefix + '.return' | translate}}</button>
</div> </div>
<div after *ngIf="groupBeingEdited !== null" class="btn-group"> <div after *ngIf="groupBeingEdited !== undefined" class="btn-group">
<button class="btn btn-danger delete-button" [disabled]="(canEdit$ | async) === false || groupBeingEdited.permanent" <button class="btn btn-danger delete-button" [disabled]="(canEdit$ | async) === false || groupBeingEdited?.permanent"
(click)="delete()"> (click)="delete()">
<i class="fa fa-trash"></i> {{ messagePrefix + '.actions.delete' | translate}} <i class="fa fa-trash"></i> {{ messagePrefix + '.actions.delete' | translate}}
</button> </button>
@@ -48,10 +48,10 @@
</ds-form> </ds-form>
<div class="mb-5"> <div class="mb-5">
<ds-members-list *ngIf="groupBeingEdited !== null" <ds-members-list *ngIf="groupBeingEdited !== undefined"
[messagePrefix]="messagePrefix + '.members-list'"></ds-members-list> [messagePrefix]="messagePrefix + '.members-list'"></ds-members-list>
</div> </div>
<ds-subgroups-list *ngIf="groupBeingEdited !== null" <ds-subgroups-list *ngIf="groupBeingEdited !== undefined"
[messagePrefix]="messagePrefix + '.subgroups-list'"></ds-subgroups-list> [messagePrefix]="messagePrefix + '.subgroups-list'"></ds-subgroups-list>

View File

@@ -282,11 +282,11 @@ describe('Pagination component', () => {
changePage(testFixture, 3); changePage(testFixture, 3);
tick(); tick();
expect(paginationService.updateRoute).toHaveBeenCalledWith('test', Object.assign({ page: '3' }), {}, false); expect(paginationService.updateRoute).toHaveBeenCalledWith('test', Object.assign({ page: 3 }), {}, false);
changePage(testFixture, 0); changePage(testFixture, 0);
tick(); tick();
expect(paginationService.updateRoute).toHaveBeenCalledWith('test', Object.assign({ page: '2' }), {}, false); expect(paginationService.updateRoute).toHaveBeenCalledWith('test', Object.assign({ page: 2 }), {}, false);
})); }));
it('should set correct pageSize route parameters', fakeAsync(() => { it('should set correct pageSize route parameters', fakeAsync(() => {
@@ -296,7 +296,7 @@ describe('Pagination component', () => {
changePageSize(testFixture, '20'); changePageSize(testFixture, '20');
tick(); tick();
expect(paginationService.updateRoute).toHaveBeenCalledWith('test', Object.assign({ pageId: 'test', page: 1, pageSize: 20 }), {}, false); expect(paginationService.updateRoute).toHaveBeenCalledWith('test', Object.assign({ page: 1, pageSize: 20 }), {}, false);
})); }));
it('should respond to windows resize', () => { it('should respond to windows resize', () => {