Purpose
- This workspace contains an Angular library,
@angular-architects/ngrx-hateoas, built on top of the NgRx Signal Store. The library helps load hypermedia JSON resources into a reactive signal-based store, mutate state locally and execute hypermedia-driven actions.
Key locations
- Library source:
libs/ngrx-hateoas - Documentation (user guide):
doc/docs/guide(see Getting Started, Concept, Pipes, Configuration, Loading Features, State Mutation Features, Action Features) - Playground app (demo + local server):
apps/playground(containsserver.jsanddb.jsonfor local demonstration)
How tests are written (libs/ngrx-hateoas)
- Location:
libs/ngrx-hateoas/src/lib/**/*.spec.ts. - Framework / runner: Angular unit tests using Jasmine (see
tsconfig.spec.jsontypes:jasmine) and Angular TestBed utilities. - Common patterns:
- Use
TestBed.configureTestingModule(...)with providers such asprovideZonelessChangeDetection(),provideHttpClient()andprovideHttpClientTesting()where needed. - Services that call HTTP use
HttpTestingControllerandexpectOne(...).flush(...)to simulate server responses and assert request properties (method, body, headers). - Many tests assert metastate signals (e.g.,
isLoading,isLoaded,isAvailable) and verify reactive behavior (cancellation of previous requests, reactive reloads when aSignalchanges) viasignalStore,signal()andTestBed.flushEffects()where applicable. - Tests use
async/awaitorexpectAsyncfor promise-based operations and standard Jasmine matchers (toBeTrue,toBeFalse,toEqual,toBe,toBeDefined, etc.). - Tests cover pipes, services (request/hateoas), and store-features (loading, writable copies, actions), focusing on isolated unit behavior.
- Use
Playground / local demo
apps/playgroundcontains a minimal Angular app and local server artifacts (db.json,server.js) useful to run the library locally against a fake REST API for manual testing and demos.
Rules for agents (editing / extending)
- When changing features, update matching docs in
doc/docs/guide/*and add/adjust unit tests underlibs/ngrx-hateoas/src/lib/**. - For HTTP-related behavior, follow existing test patterns using
provideHttpClientTesting()andHttpTestingController. - Use
provideZonelessChangeDetection()in TestBed providers to match existing test environment.
References
- See
doc/docs/guide/01-getting-started.mdanddoc/docs/guide/02-concept.mdfor conceptual details and examples.