Skip to content

Commit

Permalink
fix tests v2
Browse files Browse the repository at this point in the history
  • Loading branch information
BSekula committed Aug 8, 2024
1 parent b503596 commit a909c03
Show file tree
Hide file tree
Showing 13 changed files with 43 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import { HarnessLoader } from '@angular/cdk/testing';
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
import { MatProgressBarHarness } from '@angular/material/progress-bar/testing';
import { MatSlideToggleHarness } from '@angular/material/slide-toggle/testing';
import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services';

describe('ManageRulesSmartComponent', () => {
let fixture: ComponentFixture<ManageRulesSmartComponent>;
Expand All @@ -71,6 +72,7 @@ describe('ManageRulesSmartComponent', () => {
toggleAppNavBar$: new Subject()
}
},
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock },
{ provide: Store, useValue: { dispatch: () => {} } },
{ provide: ActivatedRoute, useValue: { params: of({ nodeId: owningFolderIdMock }) } }
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { RuleActionListUiComponent } from './rule-action-list.ui-component';
import { By } from '@angular/platform-browser';
import { DebugElement } from '@angular/core';
import { RuleActionUiComponent } from './rule-action.ui-component';
import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services';

describe('RuleActionListUiComponent', () => {
let fixture: ComponentFixture<RuleActionListUiComponent>;
Expand All @@ -38,7 +39,8 @@ describe('RuleActionListUiComponent', () => {

beforeEach(() => {
TestBed.configureTestingModule({
imports: [CoreTestingModule]
imports: [CoreTestingModule],
providers: [{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }]
});

fixture = TestBed.createComponent(RuleActionListUiComponent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import {
import { By } from '@angular/platform-browser';
import { dummyCategoriesConstraints, dummyConstraints, dummyTagsConstraints } from '../../mock/action-parameter-constraints.mock';
import { securityMarksResponseMock, updateNotificationMock } from '../../mock/security-marks.mock';
import { CategoryService, NodeAction, TagService } from '@alfresco/adf-content-services';
import { AlfrescoApiService, AlfrescoApiServiceMock, CategoryService, NodeAction, TagService } from '@alfresco/adf-content-services';
import { MatDialog, MatDialogRef } from '@angular/material/dialog';
import { HarnessLoader } from '@angular/cdk/testing';
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
Expand Down Expand Up @@ -63,7 +63,8 @@ describe('RuleActionUiComponent', () => {

beforeEach(() => {
TestBed.configureTestingModule({
imports: [CoreTestingModule, RuleActionUiComponent]
imports: [CoreTestingModule, RuleActionUiComponent],
providers: [{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }]
});

fixture = TestBed.createComponent(RuleActionUiComponent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,15 @@ import {
compositeConditionWithThreeConditionMock
} from '../../mock/conditions.mock';
import { RuleSimpleConditionUiComponent } from './rule-simple-condition.ui-component';
import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services';

describe('RuleCompositeConditionUiComponent', () => {
let fixture: ComponentFixture<RuleCompositeConditionUiComponent>;

beforeEach(() => {
TestBed.configureTestingModule({
imports: [CoreTestingModule, RuleCompositeConditionUiComponent, RuleSimpleConditionUiComponent]
imports: [CoreTestingModule, RuleCompositeConditionUiComponent, RuleSimpleConditionUiComponent],
providers: [{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }]
});

fixture = TestBed.createComponent(RuleCompositeConditionUiComponent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { CoreTestingModule } from '@alfresco/adf-core';
import { By } from '@angular/platform-browser';
import { DebugElement } from '@angular/core';
import { tagMock, mimeTypeMock, simpleConditionUnknownFieldMock, categoriesListMock } from '../../mock/conditions.mock';
import { CategoryService, TagService } from '@alfresco/adf-content-services';
import { AlfrescoApiService, AlfrescoApiServiceMock, CategoryService, TagService } from '@alfresco/adf-content-services';
import { of } from 'rxjs';
import { RuleSimpleCondition } from '../../model/rule-simple-condition.model';
import { delay } from 'rxjs/operators';
Expand Down Expand Up @@ -83,7 +83,8 @@ describe('RuleSimpleConditionUiComponent', () => {

beforeEach(() => {
TestBed.configureTestingModule({
imports: [CoreTestingModule, RuleSimpleConditionUiComponent]
imports: [CoreTestingModule, RuleSimpleConditionUiComponent],
providers: [{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }]
});

fixture = TestBed.createComponent(RuleSimpleConditionUiComponent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { RuleDetailsUiComponent } from './rule-details.ui-component';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { CoreTestingModule } from '@alfresco/adf-core';
import { of, timer } from 'rxjs';
import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services';

describe('EditRuleDialogSmartComponent', () => {
let fixture: ComponentFixture<EditRuleDialogUiComponent>;
Expand All @@ -43,7 +44,8 @@ describe('EditRuleDialogSmartComponent', () => {
imports: [CoreTestingModule, EditRuleDialogUiComponent],
providers: [
{ provide: MatDialogRef, useValue: dialogRef },
{ provide: MAT_DIALOG_DATA, useValue: dialogOptions }
{ provide: MAT_DIALOG_DATA, useValue: dialogOptions },
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }
]
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import { MAT_FORM_FIELD_DEFAULT_OPTIONS } from '@angular/material/form-field';
import { HarnessLoader } from '@angular/cdk/testing';
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
import { MatSelectHarness } from '@angular/material/select/testing';
import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services';

describe('RuleOptionsUiComponent', () => {
let fixture: ComponentFixture<RuleOptionsUiComponent>;
Expand Down Expand Up @@ -62,7 +63,16 @@ describe('RuleOptionsUiComponent', () => {
TestBed.configureTestingModule({
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [FormsModule, ReactiveFormsModule, CoreTestingModule, RuleOptionsUiComponent],
providers: [{ provide: MAT_FORM_FIELD_DEFAULT_OPTIONS, useValue: { floatLabel: 'auto' } }]
providers: [
{
provide: MAT_FORM_FIELD_DEFAULT_OPTIONS,
useValue: { floatLabel: 'auto' }
},
{
provide: AlfrescoApiService,
useClass: AlfrescoApiServiceMock
}
]
});

fixture = TestBed.createComponent(RuleOptionsUiComponent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { By } from '@angular/platform-browser';
import { RuleTriggersUiComponent } from './triggers/rule-triggers.ui-component';
import { RuleOptionsUiComponent } from './options/rule-options.ui-component';
import { RuleActionListUiComponent } from './actions/rule-action-list.ui-component';
import { CategoryService } from '@alfresco/adf-content-services';
import { AlfrescoApiService, AlfrescoApiServiceMock, CategoryService } from '@alfresco/adf-content-services';

describe('RuleDetailsUiComponent', () => {
let fixture: ComponentFixture<RuleDetailsUiComponent>;
Expand All @@ -55,7 +55,8 @@ describe('RuleDetailsUiComponent', () => {

beforeEach(() => {
TestBed.configureTestingModule({
imports: [CoreTestingModule, RuleDetailsUiComponent]
imports: [CoreTestingModule, RuleDetailsUiComponent],
providers: [{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }]
});

fixture = TestBed.createComponent(RuleDetailsUiComponent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
import { CoreTestingModule } from '@alfresco/adf-core';
import { DebugElement } from '@angular/core';
import { By } from '@angular/platform-browser';
import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services';

describe('RuleTriggerUiComponent', () => {
let fixture: ComponentFixture<RuleTriggersUiComponent>;
Expand All @@ -41,7 +42,8 @@ describe('RuleTriggerUiComponent', () => {

beforeEach(() => {
TestBed.configureTestingModule({
imports: [CoreTestingModule, RuleTriggersUiComponent]
imports: [CoreTestingModule, RuleTriggersUiComponent],
providers: [{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }]
});

fixture = TestBed.createComponent(RuleTriggersUiComponent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { DebugElement } from '@angular/core';
import { By } from '@angular/platform-browser';
import { owningFolderIdMock } from '../../mock/node.mock';
import { of } from 'rxjs';
import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services';

describe('RuleListUiComponent', () => {
let fixture: ComponentFixture<RuleListUiComponent>;
Expand All @@ -38,7 +39,8 @@ describe('RuleListUiComponent', () => {

beforeEach(() => {
TestBed.configureTestingModule({
imports: [CoreTestingModule, RuleListUiComponent]
imports: [CoreTestingModule, RuleListUiComponent],
providers: [{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }]
});

fixture = TestBed.createComponent(RuleListUiComponent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@ import { actionDefListMock, actionsTransformedListMock } from '../mock/actions.m
import { take } from 'rxjs/operators';
import { dummyConstraints, rawConstraints } from '../mock/action-parameter-constraints.mock';
import { of } from 'rxjs';
import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services';

describe('ActionsService', () => {
let actionsService: ActionsService;

beforeEach(() => {
TestBed.configureTestingModule({
imports: [CoreTestingModule],
providers: [ActionsService]
providers: [ActionsService, { provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }]
});

actionsService = TestBed.inject(ActionsService);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import { of } from 'rxjs';
import { getDefaultRuleSetResponseMock, getRuleSetsResponseMock, inheritedRuleSetMock, ownedRuleSetMock } from '../mock/rule-sets.mock';
import { take } from 'rxjs/operators';
import { inheritedRulesMock, linkedRulesMock, ownedRulesMock, ruleMock } from '../mock/rules.mock';
import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services';

describe('FolderRuleSetsService', () => {
let folderRuleSetsService: FolderRuleSetsService;
Expand All @@ -45,7 +46,7 @@ describe('FolderRuleSetsService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [CoreTestingModule],
providers: [FolderRuleSetsService, FolderRulesService, ContentApiService]
providers: [FolderRuleSetsService, FolderRulesService, ContentApiService, { provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }]
});

folderRuleSetsService = TestBed.inject(FolderRuleSetsService);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import {
import { ruleSetMock } from '../mock/rule-sets.mock';
import { owningFolderIdMock } from '../mock/node.mock';
import { take } from 'rxjs/operators';
import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services';

describe('FolderRulesService', () => {
let folderRulesService: FolderRulesService;
Expand All @@ -56,7 +57,7 @@ describe('FolderRulesService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [CoreTestingModule],
providers: [FolderRulesService]
providers: [FolderRulesService, { provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }]
});

folderRulesService = TestBed.inject<FolderRulesService>(FolderRulesService);
Expand Down

0 comments on commit a909c03

Please sign in to comment.