From d15a02c0964da452244f7ae63617ac21cfda99c7 Mon Sep 17 00:00:00 2001 From: cmoinier Date: Wed, 30 Oct 2024 15:08:54 +0100 Subject: [PATCH] fix(me): remove UT for uuid field --- .../form-field/form-field.component.spec.ts | 25 ------------------- .../src/lib/services/editor.service.spec.ts | 6 ++--- 2 files changed, 3 insertions(+), 28 deletions(-) diff --git a/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.spec.ts b/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.spec.ts index 9a8656d28c..03a620834e 100644 --- a/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.spec.ts +++ b/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.spec.ts @@ -1,13 +1,11 @@ import { ComponentFixture, TestBed } from '@angular/core/testing' import { By } from '@angular/platform-browser' -import { FormFieldWrapperComponent } from '@geonetwork-ui/ui/layout' import { TranslateModule } from '@ngx-translate/core' import { MockBuilder } from 'ng-mocks' import { FormFieldLicenseComponent } from './form-field-license/form-field-license.component' import { FormFieldOverviewsComponent } from './form-field-overviews/form-field-overviews.component' import { FormFieldDateUpdatedComponent } from './form-field-date-updated/form-field-date-updated.component' import { FormFieldRichComponent } from './form-field-rich/form-field-rich.component' -import { FormFieldSimpleComponent } from './form-field-simple/form-field-simple.component' import { FormFieldSpatialExtentComponent } from './form-field-spatial-extent/form-field-spatial-extent.component' import { FormFieldTemporalExtentsComponent } from './form-field-temporal-extents/form-field-temporal-extents.component' import { FormFieldUpdateFrequencyComponent } from './form-field-update-frequency/form-field-update-frequency.component' @@ -104,29 +102,6 @@ describe('FormFieldComponent', () => { expect(formField).toBeTruthy() }) }) - describe('simple field', () => { - let fieldWrapper - let formField - beforeEach(async () => { - component.model = 'uniqueIdentifier' - fixture.detectChanges() - await fixture.whenStable() - fieldWrapper = fixture.debugElement.query( - By.directive(FormFieldWrapperComponent) - ).componentInstance - formField = fixture.debugElement.query( - By.directive(FormFieldSimpleComponent) - ).componentInstance - }) - it('creates a simple field field (unique identifier)', () => { - expect(formField).toBeTruthy() - expect(formField.type).toEqual('text') - expect(formField.readonly).toEqual(true) - }) - it('creates a form field wrapper', () => { - expect(fieldWrapper).toBeTruthy() - }) - }) describe('spatial extent field', () => { let formField beforeEach(() => { diff --git a/libs/feature/editor/src/lib/services/editor.service.spec.ts b/libs/feature/editor/src/lib/services/editor.service.spec.ts index f5cb0121bf..abd5634de7 100644 --- a/libs/feature/editor/src/lib/services/editor.service.spec.ts +++ b/libs/feature/editor/src/lib/services/editor.service.spec.ts @@ -15,7 +15,7 @@ const SAMPLE_RECORD: CatalogRecord = datasetRecordsFixture()[0] class RecordsRepositoryMock { openRecordForEdition = jest.fn(() => of([ - { ...SAMPLE_RECORD, recordUpdated: new Date() }, + { ...SAMPLE_RECORD, resourceUpdated: new Date() }, 'blabla', false, ]) @@ -67,7 +67,7 @@ describe('EditorService', () => { it('calls repository.saveRecord and repository.clearRecordDraft', () => { const expected = { ...SAMPLE_RECORD, - recordUpdated: expect.any(Date), + resourceUpdated: expect.any(Date), } expect(repository.saveRecord).toHaveBeenCalledWith( expected, @@ -80,7 +80,7 @@ describe('EditorService', () => { }) it('applies field processes (update date in record)', () => { const arg = (repository.saveRecord as jest.Mock).mock.calls[0][0] - expect(arg.recordUpdated).not.toEqual(SAMPLE_RECORD.recordUpdated) + expect(arg.recordUpdated).not.toEqual(SAMPLE_RECORD.resourceUpdated) }) describe('if a new one has to be generated', () => { beforeEach(() => {