diff --git a/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-link-resources/form-field-online-link-resources.component.spec.ts b/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-link-resources/form-field-online-link-resources.component.spec.ts index ce65f266c..353287971 100644 --- a/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-link-resources/form-field-online-link-resources.component.spec.ts +++ b/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-link-resources/form-field-online-link-resources.component.spec.ts @@ -13,6 +13,7 @@ import { MatDialog, MatDialogRef } from '@angular/material/dialog' import { OnlineLinkResource } from '@geonetwork-ui/common/domain/model/record' import { ModalDialogComponent } from '@geonetwork-ui/ui/layout' import { ChangeDetectorRef } from '@angular/core' +import { EditorFacade } from '../../../../+state/editor.facade' let uploadSubject: Subject @@ -38,6 +39,10 @@ export class MatDialogMock { })) } +class EditorFacadeMock { + alreadySavedOnce$ = new BehaviorSubject(false) +} + describe('FormFieldOnlineLinkResourcesComponent', () => { let component: FormFieldOnlineLinkResourcesComponent let fixture: ComponentFixture @@ -65,6 +70,7 @@ describe('FormFieldOnlineLinkResourcesComponent', () => { detectChanges: jest.fn(), }), MockProvider(MatDialog, MatDialogMock, 'useClass'), + MockProvider(EditorFacade, EditorFacadeMock, 'useClass'), ], }).compileComponents() diff --git a/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-resources/form-field-online-resources.component.spec.ts b/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-resources/form-field-online-resources.component.spec.ts index 307a0d5a6..46d35577d 100644 --- a/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-resources/form-field-online-resources.component.spec.ts +++ b/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-resources/form-field-online-resources.component.spec.ts @@ -2,10 +2,11 @@ import { ComponentFixture, TestBed } from '@angular/core/testing' import { TranslateModule } from '@ngx-translate/core' import { FormFieldOnlineResourcesComponent } from './form-field-online-resources.component' import { MockBuilder, MockProvider } from 'ng-mocks' -import { Subject } from 'rxjs' +import { BehaviorSubject, Subject } from 'rxjs' import { PlatformServiceInterface } from '@geonetwork-ui/common/domain/platform.service.interface' import { NotificationsService } from '@geonetwork-ui/feature/notifications' import { MatDialog, MatDialogRef } from '@angular/material/dialog' +import { EditorFacade } from '../../../../+state/editor.facade' let uploadSubject: Subject class PlatformServiceInterfaceMock { @@ -21,6 +22,9 @@ export class MatDialogMock { afterClosed: () => this._subject, })) } +class EditorFacadeMock { + alreadySavedOnce$ = new BehaviorSubject(false) +} describe('FormFieldOnlineResourcesComponent', () => { let component: FormFieldOnlineResourcesComponent @@ -42,6 +46,7 @@ describe('FormFieldOnlineResourcesComponent', () => { MockProvider(NotificationsService), MockProvider(MatDialogRef), MockProvider(MatDialog, MatDialogMock, 'useClass'), + MockProvider(EditorFacade, EditorFacadeMock, 'useClass'), ], }).compileComponents() diff --git a/libs/feature/editor/src/lib/components/record-form/form-field/form-field-overviews/form-field-overviews.component.spec.ts b/libs/feature/editor/src/lib/components/record-form/form-field/form-field-overviews/form-field-overviews.component.spec.ts index a18dab701..6412f5694 100644 --- a/libs/feature/editor/src/lib/components/record-form/form-field/form-field-overviews/form-field-overviews.component.spec.ts +++ b/libs/feature/editor/src/lib/components/record-form/form-field/form-field-overviews/form-field-overviews.component.spec.ts @@ -8,6 +8,7 @@ import { PlatformServiceInterface, RecordAttachment, } from '@geonetwork-ui/common/domain/platform.service.interface' +import { EditorFacade } from '../../../../+state/editor.facade' let uploadSubject: Subject @@ -26,6 +27,10 @@ class PlatformServiceInterfaceMock { getRecordAttachments = jest.fn(() => recordAttachments) } +class EditorFacadeMock { + alreadySavedOnce$ = new BehaviorSubject(false) +} + describe('FormFieldOverviewsComponent', () => { let component: FormFieldOverviewsComponent let fixture: ComponentFixture @@ -46,6 +51,7 @@ describe('FormFieldOverviewsComponent', () => { 'useClass' ), MockProvider(NotificationsService), + MockProvider(EditorFacade, EditorFacadeMock, 'useClass'), ], }).compileComponents()