Skip to content

Commit

Permalink
fix(me): remove UT for uuid field
Browse files Browse the repository at this point in the history
  • Loading branch information
cmoinier committed Oct 30, 2024
1 parent 90d5bac commit d15a02c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 28 deletions.
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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(() => {
Expand Down
6 changes: 3 additions & 3 deletions libs/feature/editor/src/lib/services/editor.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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() },
'<xml>blabla</xml>',
false,
])
Expand Down Expand Up @@ -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,
Expand All @@ -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(() => {
Expand Down

0 comments on commit d15a02c

Please sign in to comment.