mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-10-01 14:41:14 +00:00
[ACS-10083]: unit test fix
This commit is contained in:
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
import { TestBed, fakeAsync, tick, ComponentFixture } from '@angular/core/testing';
|
import { TestBed, fakeAsync, tick, ComponentFixture } from '@angular/core/testing';
|
||||||
import { NO_ERRORS_SCHEMA, SimpleChange, SimpleChanges } from '@angular/core';
|
import { NO_ERRORS_SCHEMA, SimpleChange, SimpleChanges } from '@angular/core';
|
||||||
import { Router, ActivatedRoute, convertToParamMap } from '@angular/router';
|
import { Router, ActivatedRoute, convertToParamMap, ParamMap } from '@angular/router';
|
||||||
import { DocumentListService, FilterSearch, UploadService } from '@alfresco/adf-content-services';
|
import { DocumentListService, FilterSearch, UploadService } from '@alfresco/adf-content-services';
|
||||||
import { NodeActionsService } from '../../services/node-actions.service';
|
import { NodeActionsService } from '../../services/node-actions.service';
|
||||||
import { FilesComponent } from './files.component';
|
import { FilesComponent } from './files.component';
|
||||||
@@ -72,6 +72,11 @@ describe('FilesComponent', () => {
|
|||||||
expect(template).not.toBeNull();
|
expect(template).not.toBeNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getEncodedParamMap(initialQuery = { checkList: 'TYPE:"cm:folder"' }): ParamMap {
|
||||||
|
const encoded = btoa(JSON.stringify(initialQuery));
|
||||||
|
return convertToParamMap({ q: encoded });
|
||||||
|
}
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [AppTestingModule, FilesComponent, MatSnackBarModule],
|
imports: [AppTestingModule, FilesComponent, MatSnackBarModule],
|
||||||
@@ -193,9 +198,7 @@ describe('FilesComponent', () => {
|
|||||||
it('should set decoded query as queryParams', () => {
|
it('should set decoded query as queryParams', () => {
|
||||||
const initialQuery = { checkList: 'TYPE:"cm:folder"' };
|
const initialQuery = { checkList: 'TYPE:"cm:folder"' };
|
||||||
|
|
||||||
const encoded = btoa(JSON.stringify(initialQuery));
|
const mockParamMap = getEncodedParamMap(initialQuery);
|
||||||
|
|
||||||
const mockParamMap = convertToParamMap({ q: encoded });
|
|
||||||
|
|
||||||
Object.defineProperty(component['route'], 'queryParamMap', {
|
Object.defineProperty(component['route'], 'queryParamMap', {
|
||||||
value: of(mockParamMap)
|
value: of(mockParamMap)
|
||||||
@@ -207,7 +210,11 @@ describe('FilesComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should check isFilterHeaderActive to be true when filters are present in queryParamMap', () => {
|
it('should check isFilterHeaderActive to be true when filters are present in queryParamMap', () => {
|
||||||
Object.defineProperty(route, 'queryParamMap', { value: of({ params: { $thumbnail: 'TYPE:"cm:folder"' } }) });
|
const mockParamMap = getEncodedParamMap();
|
||||||
|
|
||||||
|
Object.defineProperty(component['route'], 'queryParamMap', {
|
||||||
|
value: of(mockParamMap)
|
||||||
|
});
|
||||||
|
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user