You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expand the CSAPI section of endpoint.spec.ts from 3 test cases to ~6 test cases. The current coverage only verifies hasConnectedSystems (true/false) and csapiCollections list, leaving several important endpoint behaviors untested.
Finding Reference: F-NEW-08 from final-project-code-review.md Severity: Minor (GAP) Category: Test coverage gap Implementation Branch:phase-6
Problem Statement
The CSAPI section of endpoint.spec.ts (lines ~2836–2865, 3 test cases) provides only minimal coverage:
hasConnectedSystems → true — Endpoint with CSAPI conformance classes
csapiCollections — Returns the list of CSAPI-conformant collections
hasConnectedSystems → false — Endpoint without CSAPI conformance classes
This leaves several gaps:
Missing Test Case
Why It Matters
getCollectionDocument direct call
The CSAPI factory relies on getCollectionDocument() to fetch individual collection metadata — this method is not directly tested in the CSAPI context
Empty collections array
Endpoint conforms to CSAPI but has zero matching collections — csapiCollections should return [], not throw
Conformance without matching collections
Endpoint advertises CSAPI conformance classes but no collection has the required itemType or link relations — edge case that could surface in the wild
Impact:OgcApiEndpoint is the integration surface that factory and consumers depend on. Gaps here mean edge cases discovered in production.
Files to Create or Modify
File
Action
Est. Lines
Purpose
src/ogc-api/endpoint.spec.ts
Modify
~60–100 added
Add 3+ test cases to the CSAPI describe block
fixtures/ogc-api/ (if needed)
Create
~30–80
Fixture data for new test scenarios
Proposed Fix
Add the following test cases to the CSAPI section of endpoint.spec.ts:
Test 1: getCollectionDocument direct call
Call getCollectionDocument() for a known CSAPI collection. Verify it returns the expected collection document with CSAPI-specific fields (links, itemType, etc.).
Test 2: Empty CSAPI collections
Mock an endpoint that has CSAPI conformance classes in its conformance document but no collections with matching CSAPI characteristics. Verify csapiCollections returns [] and hasConnectedSystems still returns true (conformance is present even if no collections match).
Test 3: Conformance without matching collections
Mock an endpoint where the conformance document includes CSAPI classes but the collections lack the required itemType: "feature" or CSAPI-specific link relations. Verify the endpoint correctly reports conformance but returns an empty (or appropriately filtered) collection list.
Each test should follow the existing patterns in endpoint.spec.ts:
Use the fixture-based mocking approach (fetch interceptor)
Mirror the structure of existing CSAPI tests in the describe('CSAPI') block
Scope — What NOT to Touch
❌ Do NOT modify endpoint.ts implementation (this is test-only)
❌ Do NOT modify factory.ts, factory.spec.ts, url_builder.ts, or index.ts
❌ Do NOT modify any parser or format handler
❌ Do NOT modify any CSAPI business logic
❌ Do NOT add integration tests or live server calls — unit tests only
Acceptance Criteria
CSAPI section of endpoint.spec.ts contains ≥6 test cases (current 3 + ≥3 new)
All new tests verify a distinct behavior path through the CSAPI endpoint methods
All new tests use consistent fixture/mocking patterns with existing tests
npm run test:node passes
npm run lint passes
No changes to any .ts file outside endpoint.spec.ts (and optional fixture files)
Note: The testing research at docs/research/testing/findings/ was conducted before Phase 6. It covers the broader CSAPI testing vision (~26 integration workflows, ~280 error scenarios, 8+ server profiles). That broader vision is not Phase 6 scope. Only the references directly applicable to this issue's scope (expanding the CSAPI section from 3 to ~6 tests) are included above. Phase 6's goal (per P6-contribution-goal-and-definition.md) is to satisfy jahow's architectural requirements and pass upstream CI.
Key insights from research:
EDR precedent (Finding 01 §1): The EDR section in endpoint.spec.ts has 13 integration test scenarios across conformance detection, collection listing, query building, and error handling (298 lines added). The CSAPI section currently has 3 tests (~30 lines). The EDR section is the direct upstream model that jahow accepted in PR parseResourceRef() should normalize type to rt for OSH @link objects (P5-F5) #114. While expanding to 13 scenarios is not required, the comparison shows significant room to strengthen the CSAPI section.
Upstream consistency (Finding 02): Integration tests in endpoint.spec.ts are the standard pattern across all 6 upstream implementations (WFS, WMS, WMTS, TMS, STAC, EDR). The existing 3 CSAPI tests already follow the conventions: fixture-driven fetch mocking, describe/it blocks, beforeEach setup. New tests should continue this pattern.
Conformance landscape (Finding 22 §1–§2): Documents 25 modular CSAPI conformance classes across Parts 1 and 2. Real server profiles: OpenSensorHub = full conformance (33/33 classes), 52°North = partial Part 2 (DataStreams only, no ControlStreams). §2.3 provides 6 minimum viable configuration profiles with ready-to-use conformsTo JSON arrays.
⚠️ CRITICAL: Conformance URI Caveat
Finding 22's conformance class catalog uses URI patterns from the specification annexes (e.g., /conf/api-common, /conf/system, /conf/datastream). However, the actual code (checkHasConnectedSystems at src/ogc-api/info.ts:112) checks for only two specific URIs:
Any new test fixtures must use these URIs (which the existing fixture at fixtures/ogc-api/csapi/sample-data-hub/conformance.json already uses correctly). Do not derive fixture URIs from Finding 22's annex tables — test what the code actually checks.
checkHasConnectedSystems logic (src/ogc-api/info.ts:112): Returns true if the conformance array contains eitherconf/core (Part 1) ORconf/dynamic-data (Part 2). This means:
An endpoint with only Part 1 conformance → true
An endpoint with only Part 2 conformance → true
An endpoint with both → true (current fixture)
An endpoint with neither → false (already tested)
Testing Part 1-only and Part 2-only detection are potential additional test cases that would strengthen coverage of this OR-logic.
Untested path: Conformance passes but no collection has CSAPI link relations (e.g., ogc-cs:systems, ogc-cs:datastreams) → should return []. This maps directly to proposed Tests 2 and 3.
Discovery workflow (Finding 14 §3): The existing 3 tests cover the core Discovery scenarios (conformance detection true/false, collection listing). The proposed expansion adds the edge cases that were identified as distinct scenarios in the research but not yet implemented.
Task
Expand the CSAPI section of
endpoint.spec.tsfrom 3 test cases to ~6 test cases. The current coverage only verifieshasConnectedSystems(true/false) andcsapiCollectionslist, leaving several important endpoint behaviors untested.Finding Reference: F-NEW-08 from final-project-code-review.md
Severity: Minor (GAP)
Category: Test coverage gap
Implementation Branch:
phase-6Problem Statement
The CSAPI section of
endpoint.spec.ts(lines ~2836–2865, 3 test cases) provides only minimal coverage:hasConnectedSystems→ true — Endpoint with CSAPI conformance classescsapiCollections— Returns the list of CSAPI-conformant collectionshasConnectedSystems→ false — Endpoint without CSAPI conformance classesThis leaves several gaps:
getCollectionDocumentdirect callgetCollectionDocument()to fetch individual collection metadata — this method is not directly tested in the CSAPI contextcsapiCollectionsshould return[], not throwitemTypeor link relations — edge case that could surface in the wildImpact:
OgcApiEndpointis the integration surface that factory and consumers depend on. Gaps here mean edge cases discovered in production.Files to Create or Modify
src/ogc-api/endpoint.spec.tsdescribeblockfixtures/ogc-api/(if needed)Proposed Fix
Add the following test cases to the CSAPI section of
endpoint.spec.ts:Test 1:
getCollectionDocumentdirect callCall
getCollectionDocument()for a known CSAPI collection. Verify it returns the expected collection document with CSAPI-specific fields (links, itemType, etc.).Test 2: Empty CSAPI collections
Mock an endpoint that has CSAPI conformance classes in its conformance document but no collections with matching CSAPI characteristics. Verify
csapiCollectionsreturns[]andhasConnectedSystemsstill returnstrue(conformance is present even if no collections match).Test 3: Conformance without matching collections
Mock an endpoint where the conformance document includes CSAPI classes but the collections lack the required
itemType: "feature"or CSAPI-specific link relations. Verify the endpoint correctly reports conformance but returns an empty (or appropriately filtered) collection list.Each test should follow the existing patterns in
endpoint.spec.ts:describe('CSAPI')blockScope — What NOT to Touch
endpoint.tsimplementation (this is test-only)factory.ts,factory.spec.ts,url_builder.ts, orindex.tsAcceptance Criteria
endpoint.spec.tscontains ≥6 test cases (current 3 + ≥3 new)npm run test:nodepassesnpm run lintpasses.tsfile outsideendpoint.spec.ts(and optional fixture files)Dependencies
Blocked by: Nothing (independent of #129, #130, #131, #132)
Blocks: Nothing
Operational Constraints
Key constraints:
endpoint.spec.tsCSAPI section, nothing moreReferences
src/ogc-api/endpoint.spec.tslines ~2836–2865src/ogc-api/endpoint.tsfactory.spec.tsexpansion (recommended to implement together)endpoint.spec.ts) — upstream model accepted by jahow in PR #114endpoint.spec.tsis standard across all 6 implementationsTesting Research Context
Key insights from research:
EDR precedent (Finding 01 §1): The EDR section in
endpoint.spec.tshas 13 integration test scenarios across conformance detection, collection listing, query building, and error handling (298 lines added). The CSAPI section currently has 3 tests (~30 lines). The EDR section is the direct upstream model that jahow accepted in PR parseResourceRef() should normalizetypetortfor OSH @link objects (P5-F5) #114. While expanding to 13 scenarios is not required, the comparison shows significant room to strengthen the CSAPI section.Upstream consistency (Finding 02): Integration tests in
endpoint.spec.tsare the standard pattern across all 6 upstream implementations (WFS, WMS, WMTS, TMS, STAC, EDR). The existing 3 CSAPI tests already follow the conventions: fixture-driven fetch mocking,describe/itblocks,beforeEachsetup. New tests should continue this pattern.Conformance landscape (Finding 22 §1–§2): Documents 25 modular CSAPI conformance classes across Parts 1 and 2. Real server profiles: OpenSensorHub = full conformance (33/33 classes), 52°North = partial Part 2 (DataStreams only, no ControlStreams). §2.3 provides 6 minimum viable configuration profiles with ready-to-use
conformsToJSON arrays.checkHasConnectedSystemslogic (src/ogc-api/info.ts:112): Returnstrueif the conformance array contains eitherconf/core(Part 1) ORconf/dynamic-data(Part 2). This means:truetruetrue(current fixture)false(already tested)csapiCollectionsfiltering chain (src/ogc-api/endpoint.ts:230):Promise.all([this.data, this.hasConnectedSystems])— parallel fetch!hasCSAPI, short-circuits to{ collections: [] }(already tested via non-CSAPI case)parseCollections()→.filter(c => c.hasConnectedSystems)→.map(c => c.name)ogc-cs:systems,ogc-cs:datastreams) → should return[]. This maps directly to proposed Tests 2 and 3.Discovery workflow (Finding 14 §3): The existing 3 tests cover the core Discovery scenarios (conformance detection true/false, collection listing). The proposed expansion adds the edge cases that were identified as distinct scenarios in the research but not yet implemented.