mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
fix random test failing part 2 (#3395)
* fix random failing test core search/comment/auth/user * fix node delete directive * fix lint issues * node restore fix * fix comment test * remove fdescribe * fix tests and tslint * fix upload test * unsubscribe success event task test * copy comment object during test * use the data pipe performance improvement and standard usage * uncomment random test * fix comment date random failing test * disposable unsubscribe * fix start process * remove fdescribe * change start process test and remove commented code * fix error event check double click * clone object form test * refactor date time test * fix service mock * fix test dropdown and context * git hook lint * fix language test * unsubscribe documentlist event test * fix disposable error * fix console log service error document list * unusbscribe search test * clear input field * remove wrong test
This commit is contained in:
committed by
Denys Vuika
parent
22006395c7
commit
eb0f91c5db
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { async, TestBed } from '@angular/core/testing';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { AppConfigService } from '../app-config/app-config.service';
|
||||
import { StorageService } from './storage.service';
|
||||
@@ -32,6 +32,7 @@ describe('UserPreferencesService', () => {
|
||||
let storage: StorageService;
|
||||
let appConfig: AppConfigService;
|
||||
let translate: TranslateService;
|
||||
let changeDisposable: any;
|
||||
|
||||
setupTestBed({
|
||||
imports: [CoreTestingModule]
|
||||
@@ -50,6 +51,12 @@ describe('UserPreferencesService', () => {
|
||||
translate = TestBed.get(TranslateService);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
if (changeDisposable) {
|
||||
changeDisposable.unsubscribe();
|
||||
}
|
||||
});
|
||||
|
||||
it('should get default pagination from app config', () => {
|
||||
appConfig.config.pagination.size = 0;
|
||||
expect(preferences.defaults.paginationSize).toBe(defaultPaginationSize);
|
||||
@@ -132,25 +139,28 @@ describe('UserPreferencesService', () => {
|
||||
expect(preferences.locale).toBe('fake-store-locate');
|
||||
});
|
||||
|
||||
it('should stream the page size value when is set', async(() => {
|
||||
it('should stream the page size value when is set', (done) => {
|
||||
preferences.paginationSize = 5;
|
||||
preferences.onChange.subscribe((userPreferenceStatus) => {
|
||||
changeDisposable = preferences.onChange.subscribe((userPreferenceStatus) => {
|
||||
expect(userPreferenceStatus.PAGINATION_SIZE).toBe(5);
|
||||
done();
|
||||
});
|
||||
}));
|
||||
});
|
||||
|
||||
it('should stream the user preference status when changed', async(() => {
|
||||
it('should stream the user preference status when changed', (done) => {
|
||||
preferences.set('propertyA', 'valueA');
|
||||
preferences.onChange.subscribe((userPreferenceStatus) => {
|
||||
changeDisposable = preferences.onChange.subscribe((userPreferenceStatus) => {
|
||||
expect(userPreferenceStatus.propertyA).toBe('valueA');
|
||||
done();
|
||||
});
|
||||
}));
|
||||
});
|
||||
|
||||
it('should stream only the selected attribute changes when using select', async(() => {
|
||||
it('should stream only the selected attribute changes when using select', (done) => {
|
||||
preferences.disableCSRF = true;
|
||||
preferences.select(UserPreferenceValues.DisableCSRF).subscribe((disableCSRFFlag) => {
|
||||
expect(disableCSRFFlag).toBeTruthy();
|
||||
done();
|
||||
});
|
||||
}));
|
||||
});
|
||||
|
||||
});
|
||||
|
Reference in New Issue
Block a user