prepare tests for ng-12 upgrade (#7099)

* prepare tests for ng12 upgrade

* fix lint

* fix tests

* test fixes

* fix code and tests

* fix code and tests

* test fixes

* test fixes
This commit is contained in:
Denys Vuika
2021-06-11 07:36:32 +01:00
committed by GitHub
parent 558056b05c
commit eb71a79d1e
112 changed files with 982 additions and 1057 deletions

View File

@@ -41,7 +41,7 @@ describe('NodeDownloadDirective', () => {
let apiService: AlfrescoApiService;
let contentService;
let dialogSpy;
const mockOauth2Auth = {
const mockOauth2Auth: any = {
oauth2Auth: {
callCustomApi: () => Promise.resolve()
},
@@ -159,7 +159,7 @@ describe('NodeDownloadDirective', () => {
});
it('should create link element to download file node', () => {
const dummyLinkElement = {
const dummyLinkElement: any = {
download: null,
href: null,
click: () => null,

View File

@@ -72,7 +72,7 @@ describe('NodeFavoriteDirective', () => {
});
it('should reset favorites if selection is empty', fakeAsync(() => {
spyOn(alfrescoApiService.getInstance().core.favoritesApi, 'getFavorite').and.returnValue(Promise.resolve());
spyOn(alfrescoApiService.getInstance().core.favoritesApi, 'getFavorite').and.returnValue(Promise.resolve(null));
const selection = [
{ entry: { id: '1', name: 'name1' } }
@@ -97,7 +97,7 @@ describe('NodeFavoriteDirective', () => {
beforeEach(() => {
favoritesApiSpy = spyOn(alfrescoApiService.getInstance().core.favoritesApi, 'getFavorite')
.and.returnValue(Promise.resolve());
.and.returnValue(Promise.resolve(null));
});
it('should check each selected node if it is a favorite', fakeAsync(() => {
@@ -341,7 +341,7 @@ describe('NodeFavoriteDirective', () => {
}));
it('should process node as favorite', fakeAsync(() => {
spyOn(alfrescoApiService.getInstance().core.favoritesApi, 'getFavorite').and.returnValue(Promise.resolve());
spyOn(alfrescoApiService.getInstance().core.favoritesApi, 'getFavorite').and.returnValue(Promise.resolve(null));
const selection = [
{ entry: { id: '1', name: 'name1' } }

View File

@@ -110,7 +110,7 @@ describe('UploadDirective', () => {
it('should raise upload-files event on files drop', (done) => {
directive.enabled = true;
const event = jasmine.createSpyObj('event', ['preventDefault', 'stopPropagation']);
spyOn(directive, 'getDataTransfer').and.returnValue({});
spyOn(directive, 'getDataTransfer').and.returnValue({} as any);
spyOn(directive, 'getFilesDropped').and.returnValue(Promise.resolve([
<FileInfo> {},
<FileInfo> {}
@@ -127,7 +127,7 @@ describe('UploadDirective', () => {
<FileInfo> {}
];
const event = jasmine.createSpyObj('event', ['preventDefault', 'stopPropagation']);
spyOn(directive, 'getDataTransfer').and.returnValue({});
spyOn(directive, 'getDataTransfer').and.returnValue({} as any);
spyOn(directive, 'getFilesDropped').and.returnValue(Promise.resolve(files));
spyOn(nativeElement, 'dispatchEvent').and.callFake((e) => {

View File

@@ -22,6 +22,7 @@ import { TestBed, ComponentFixture } from '@angular/core/testing';
import { setupTestBed } from '../testing/setup-test-bed';
import { CoreTestingModule } from '../testing/core.testing.module';
import { VersionCompatibilityService } from '../services/version-compatibility.service';
import { VersionModel } from '../models/product-version.model';
@Component({
template: `
@@ -51,12 +52,12 @@ describe('VersionCompatibilityDirective', () => {
let fixture: ComponentFixture<TestComponent>;
let versionCompatibilityService: VersionCompatibilityService;
const acsResponceMock = {
const acsResponceMock = new VersionModel({
display: '7.0.1',
major: '7',
minor: '0',
patch: '1'
};
});
setupTestBed({
imports: [