Ban xit and xdescribe use in the future (#4923)

* remove xit test and ban xit and xdescribe use in the future

* remove xit test and ban xit and xdescribe use in the future

* remove test excluded

* remove consecutive blank line
This commit is contained in:
Eugenio Romano
2019-07-12 15:04:53 +01:00
committed by GitHub
parent 07213fac3a
commit b28a53afe7
28 changed files with 7 additions and 893 deletions

View File

@@ -15,10 +15,9 @@
* limitations under the License.
*/
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { CardViewSelectItemModel } from '../../models/card-view-selectitem.model';
import { CardViewUpdateService } from '../../services/card-view-update.service';
import { CardViewSelectItemComponent } from './card-view-selectitem.component';
import { setupTestBed } from '../../../testing/setupTestBed';
import { CoreTestingModule } from '../../../testing/core.testing.module';
@@ -28,7 +27,6 @@ describe('CardViewSelectItemComponent', () => {
let fixture: ComponentFixture<CardViewSelectItemComponent>;
let component: CardViewSelectItemComponent;
let cardViewUpdateService;
const mockData = [{ key: 'one', label: 'One' }, { key: 'two', label: 'Two' }, { key: 'three', label: 'Three' }];
const mockDefaultProps = {
label: 'Select box label',
@@ -44,7 +42,6 @@ describe('CardViewSelectItemComponent', () => {
beforeEach(() => {
fixture = TestBed.createComponent(CardViewSelectItemComponent);
cardViewUpdateService = TestBed.get(CardViewUpdateService);
component = fixture.componentInstance;
component.property = new CardViewSelectItemModel(mockDefaultProps);
});
@@ -96,27 +93,5 @@ describe('CardViewSelectItemComponent', () => {
expect(label).toBeNull();
});
xit('should update property on input blur', async(() => {
spyOn(cardViewUpdateService, 'update');
component.ngOnChanges();
component.editable = true;
fixture.detectChanges();
const selectBox = fixture.debugElement.query(By.css('[data-automation-class="select-box"]'));
selectBox.nativeElement.click();
fixture.detectChanges();
const option = fixture.debugElement.query(By.css(`mat-option[ng-reflect-value="${mockData[2].key}"]`));
option.nativeElement.click();
fixture.detectChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
expect(cardViewUpdateService.update).toHaveBeenCalled();
expect(component.property.value).toBe(mockData[2].key);
});
}));
});
});

View File

@@ -124,29 +124,6 @@ describe('DateTimeWidgetComponent', () => {
});
}));
xit('should check correctly the min value with different formats', async(() => {
widget.field = new FormFieldModel(new FormModel(), {
id: 'date-field-id',
name: 'date-name',
value: '11-29-9999 10:30 AM',
dateDisplayFormat: 'MM-DD-YYYY HH:mm A',
type: 'datetime',
readOnly: 'false',
minValue: '9999-11-30T10:30Z'
});
fixture.detectChanges();
widget.field.validate();
fixture.detectChanges();
fixture.whenStable()
.then(() => {
expect(element.querySelector('#date-field-id')).toBeDefined();
expect(element.querySelector('#date-field-id')).not.toBeNull();
const dateElement: any = element.querySelector('#date-field-id');
expect(dateElement.value).toContain('11-29-9999 10:30 AM');
expect(element.querySelector('.adf-error-text').textContent).toBe('FORM.FIELD.VALIDATOR.NOT_LESS_THAN');
});
}));
it('should show the correct format type', async(() => {
widget.field = new FormFieldModel(new FormModel(), {
id: 'date-field-id',

View File

@@ -124,29 +124,6 @@ describe('DateWidgetComponent', () => {
});
}));
xit('should check correctly the min value with different formats', async(() => {
widget.field = new FormFieldModel(new FormModel(), {
id: 'date-field-id',
name: 'date-name',
value: '11-30-9999',
type: 'date',
readOnly: 'false',
dateDisplayFormat : 'MM-DD-YYYY',
minValue : '30-12-9999'
});
fixture.detectChanges();
widget.field.validate();
fixture.whenStable()
.then(() => {
fixture.detectChanges();
expect(element.querySelector('#date-field-id')).toBeDefined();
expect(element.querySelector('#date-field-id')).not.toBeNull();
const dateElement: any = element.querySelector('#date-field-id');
expect(dateElement.value).toContain('11-30-9999');
expect(element.querySelector('.adf-error-text').textContent).toBe('FORM.FIELD.VALIDATOR.NOT_LESS_THAN');
});
}));
it('should show the correct format type', async(() => {
widget.field = new FormFieldModel(new FormModel(), {
id: 'date-field-id',

View File

@@ -488,15 +488,6 @@ describe('WidgetVisibilityCloudService', () => {
expect(isVisible).toBeTruthy();
});
xit('should return empty string for a value that is not on variable or form', () => {
visibilityObjTest.leftType = WidgetTypeEnum.field;
visibilityObjTest.leftValue = 'NO_FIELD_FORM';
const rightValue = service.getRightValue(fakeFormWithField, visibilityObjTest);
expect(rightValue).not.toBeUndefined();
expect(rightValue).toBe('');
});
it('should evaluate the visibility for the field with single visibility condition between form values', () => {
visibilityObjTest.leftType = 'LEFT_FORM_FIELD_ID';
visibilityObjTest.operator = '!=';
@@ -559,14 +550,6 @@ describe('WidgetVisibilityCloudService', () => {
expect(leftValue).toBe('form_value_test');
});
xit('should determine visibility for dropdown on label condition', () => {
const dropdownValue = service.getFieldValue(formTest.values, 'Dropdown');
expect(dropdownValue).not.toBeNull();
expect(dropdownValue).toBeDefined();
expect(dropdownValue).toBe('Dropdown');
});
it('should be able to get the value for a standard field', () => {
const dropdownValue = service.getFieldValue(formTest.values, 'test_2');
@@ -575,14 +558,6 @@ describe('WidgetVisibilityCloudService', () => {
expect(dropdownValue).toBe('value_2');
});
xit('should get the dropdown label value from a form', () => {
const dropdownValue = service.getFormValue(formTest, 'Dropdown');
expect(dropdownValue).not.toBeNull();
expect(dropdownValue).toBeDefined();
expect(dropdownValue).toBe('Dropdown');
});
it('should get the dropdown id value from a form', () => {
const dropdownValue = service.getFormValue(formTest, 'dropdown');
@@ -600,26 +575,6 @@ describe('WidgetVisibilityCloudService', () => {
expect(rightValue).toBe('dropdown_id');
});
xit('should retrieve the value for the right field when it is a dropdown label', () => {
visibilityObjTest.rightType = 'field';
visibilityObjTest.rightValue = 'Dropdown';
const rightValue = service.getRightValue(formTest, visibilityObjTest);
expect(rightValue).toBeDefined();
expect(rightValue).toBe('Dropdown');
});
xit('should be able to evaluate condition with a dropdown <label>', () => {
visibilityObjTest.leftType = 'field';
visibilityObjTest.leftValue = 'test_5';
visibilityObjTest.operator = '==';
visibilityObjTest.rightValue = 'Dropdown';
const fakeFormField: FormFieldModel = new FormFieldModel(formTest, jsonFieldFake);
service.refreshEntityVisibility(fakeFormField);
expect(fakeFormField.isVisible).toBeTruthy();
});
it('should be able to evaluate condition with a dropdown <id>', () => {
visibilityObjTest.rightType = 'field';
visibilityObjTest.leftType = 'field';

View File

@@ -21,8 +21,6 @@ import { TranslationService } from './translation.service';
import { setupTestBed } from '../testing/setupTestBed';
import { CoreModule } from '../core.module';
const componentJson1 = ' {"TEST": "This is a test", "TEST2": "This is another test"} ' ;
declare let jasmine: any;
describe('TranslateLoader', () => {
@@ -57,20 +55,4 @@ describe('TranslateLoader', () => {
expect(customLoader.providerRegistered('login')).toBeTruthy();
});
xit('should return the Json translation ', () => {
customLoader.registerProvider('login', 'path/login');
customLoader.getTranslation('en').subscribe(
(response) => {
expect(response).toBeDefined();
expect(response).toEqual(JSON.parse(componentJson1));
}
);
jasmine.Ajax.requests.mostRecent().respondWith({
'status': 200,
contentType: 'application/json',
responseText: componentJson1
});
});
});

View File

@@ -1,85 +0,0 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { SimpleChange } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { MediaPlayerComponent } from './mediaPlayer.component';
import { setupTestBed } from '../../testing/setupTestBed';
import { CoreModule } from '../../core.module';
import { ContentService } from '../../services/content.service';
xdescribe('Test Media player component ', () => {
let component: MediaPlayerComponent;
let service: ContentService;
let fixture: ComponentFixture<MediaPlayerComponent>;
function createFakeBlob() {
const data = atob('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==');
return new Blob([data], {type: 'image/png'});
}
setupTestBed({
imports: [CoreModule.forRoot()]
});
beforeEach(() => {
service = TestBed.get(ContentService);
});
beforeEach(() => {
fixture = TestBed.createComponent(MediaPlayerComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
afterEach(() => {
fixture.destroy();
});
it('should thrown an error If no url or no blob are passed', () => {
expect(() => {
component.ngOnChanges({});
}).toThrow(new Error('Attribute urlFile or blobFile is required'));
});
it('should not thrown an error If url is passed', () => {
component.urlFile = 'fake-url';
expect(() => {
component.ngOnChanges(null);
}).not.toThrow(new Error('Attribute urlFile or blobFile is required'));
});
it('should not thrown an error If url is passed', () => {
component.urlFile = 'fake-url';
expect(() => {
component.ngOnChanges(null);
}).not.toThrow(new Error('Attribute urlFile or blobFile is required'));
});
it('should not thrown an error If blob is passed', () => {
const blob = createFakeBlob();
spyOn(service, 'createTrustedUrl').and.returnValue('fake-blob-url');
const change = new SimpleChange(null, blob, true);
expect(() => {
component.ngOnChanges({ 'blobFile': change });
}).not.toThrow(new Error('Attribute urlFile or blobFile is required'));
expect(component.urlFile).toEqual('fake-blob-url');
});
});

View File

@@ -204,30 +204,6 @@ describe('ViewerComponent', () => {
});
});
xit('should extension file mp3 be loaded', (done) => {
component.urlFile = 'fake-url-file.mp3';
component.ngOnChanges(null);
fixture.detectChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
expect(element.querySelector('adf-media-player')).not.toBeNull();
done();
});
});
xit('should extension file wav be loaded', (done) => {
component.urlFile = 'fake-url-file.wav';
component.ngOnChanges(null);
fixture.detectChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
expect(element.querySelector('adf-media-player')).not.toBeNull();
done();
});
});
it('should extension file txt be loaded', (done) => {
component.urlFile = 'fake-test-file.txt';
component.ngOnChanges(null);