Unit Tests

The unit suite is split by package layer so failures stay local and easy to interpret.

Suite map:

  • test_connection_unit checks public connection normalization and environment loading

  • test_embeddings_unit isolates GoodMemEmbeddings with fake transports and fake upstream providers, including bootstrap matching and ensure-from-env behavior

  • test_resources_unit covers the public GoodMemResources facade and clean-slate vector-store bootstrap

  • test_transport_unit checks the SDK boundary and error normalization logic, including resource method mapping

  • test_vectorstore_unit covers the main LangChain-facing write and retrieval behavior

If you are debugging a regression, start with the narrowest suite that still touches the failing layer before you run the broader matrix.

Unit tests for GoodMemConnection.

This suite focuses on the public connection configuration layer.

Coverage goals:

  • constructor normalization for api_key, base_url, and verify

  • rejection of blank or invalid caller-provided values

  • environment-driven construction through GoodMemConnection.from_env()

This suite stays separate from transport or vector-store tests because it validates the package’s smallest public configuration contract in isolation.

Unit tests for GoodMemEmbeddings.

This suite exercises the embeddings adapter without talking to a real GoodMem deployment or upstream provider.

Coverage goals:

  • explicit embedder_id validation and lazy transport/provider setup

  • upstream API-key resolution from inline credentials or environment fallbacks

  • dimensions validation, provider-shape compatibility checks, and optional dependency failures

  • normalization of provider factory failures, request failures, and embedder lookup failures

The suite is kept separate because the embeddings adapter has a distinct set of boundary conditions from vector-store writes and searches.

Unit tests for the public GoodMem resource facade.

Unit tests for the GoodMem transport boundary.

This suite validates the package layer that maps normalized requests onto the official GoodMem SDK and converts SDK exceptions back into package-owned errors.

Coverage goals:

  • create-space request mapping

  • API error normalization, including duplicate-resource handling and truncated backend detail

  • streamed retrieval setup failures, context-manager failures, and preservation of consumer exceptions raised while iterating the stream

The suite stands alone because transport correctness depends on edge cases in SDK interaction rather than on public LangChain-facing behavior.

Unit tests for GoodMemVectorStore.

This suite covers the package’s main LangChain-facing workflow using fake transport implementations.

Coverage goals:

  • existing-space construction and create-helper behavior

  • create-time embedder selection and rejection of unsupported public options

  • local validation for texts, documents, metadata, IDs, and unexpected keyword arguments

  • duplicate-ID handling, partial batch failures, backend response ordering, and chunk-level search result mapping

It remains a dedicated suite because vector-store behavior spans the broadest public surface and needs focused coverage for write/search regressions.