diff --git a/libs/ui/elements/src/lib/record-api-form/record-api-form.component.spec.ts b/libs/ui/elements/src/lib/record-api-form/record-api-form.component.spec.ts index 918df0cc5c..9dca9ca78f 100644 --- a/libs/ui/elements/src/lib/record-api-form/record-api-form.component.spec.ts +++ b/libs/ui/elements/src/lib/record-api-form/record-api-form.component.spec.ts @@ -1,4 +1,4 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing' +import { ComponentFixture, TestBed } from '@angular/core/testing' import { RecordApiFormComponent } from './record-api-form.component' import { DatasetServiceDistribution } from '@geonetwork-ui/common/domain/model/record' import { firstValueFrom } from 'rxjs' @@ -15,8 +15,8 @@ const mockDatasetServiceDistribution: DatasetServiceDistribution = { jest.mock('@camptocamp/ogc-client', () => ({ OgcApiEndpoint: class { constructor(private url) {} - get featureCollections() { - return Promise.resolve(['feature1']) + get allCollections() { + return Promise.resolve([{ name: 'feature1' }]) } getCollectionInfo(collectionId) { return Promise.resolve({ @@ -66,7 +66,7 @@ jest.mock('@camptocamp/ogc-client', () => ({ }, })) -describe('RecordApFormComponent', () => { +describe('RecordApiFormComponent', () => { let component: RecordApiFormComponent let fixture: ComponentFixture diff --git a/libs/ui/elements/src/lib/record-api-form/record-api-form.component.ts b/libs/ui/elements/src/lib/record-api-form/record-api-form.component.ts index e0c61e5cee..5d7d598c10 100644 --- a/libs/ui/elements/src/lib/record-api-form/record-api-form.component.ts +++ b/libs/ui/elements/src/lib/record-api-form/record-api-form.component.ts @@ -5,7 +5,7 @@ import { ServiceProtocol, } from '@geonetwork-ui/common/domain/model/record' import { mimeTypeToFormat } from '@geonetwork-ui/util/shared' -import { BehaviorSubject, combineLatest, map, switchMap } from 'rxjs' +import { BehaviorSubject, combineLatest, filter, map, switchMap } from 'rxjs' const DEFAULT_PARAMS = { OFFSET: '', @@ -54,7 +54,8 @@ export class RecordApiFormComponent { this.offset$, this.limit$, this.format$, - this.endpoint$, + // only compute the url if the endpoint was created + this.endpoint$.pipe(filter((endpoint) => !!endpoint)), ]).pipe( switchMap(([offset, limit, format]) => this.generateApiQueryUrl(offset, limit, format)