0.1.1
Patch Changes
- #774
176e95aThanks @thevuong! - Fold di's reservedslotNamecriterion into slot addressing, so{ name: "x" }and{ tag: slotName.of("x") }— one slot to the container — are one slot to TestBed too: a mock registered with either spelling now matches a dependency declared with the other, andmocks.get(token, options)accepts both. - Updated dependencies [
96af502]:- @codefast/di@0.8.0
0.1.0
Minor Changes
- #771
33c19b7Thanks @thevuong! - Add@codefast/di-testing: solitary and sociable auto-mocking test beds for@codefast/di.TestBed.solitary(Class)reads a class's declared dependencies through di'sMetadataReader, builds a mock for each, and constructs the real unit through a container so@postConstruct, accessor injection, and@preDestroyrun as in production. The default mock is a zero-dependency spy; passmockFactory: () => vi.fn()to build the mocks from Vitest, Jest, or Sinon — the factory's return type flows through the bed, so each backend's own mock API type-checks onmocks.get(...)and inside.stubcallbacks with no adapter packages. Overrides cover fixed sealed values (.using), partial stubs (.stub), absent optionals (.absent),injectAllelement lists (.usingAll), and slot-targeted mocks (.mock(token, { name })); beds exposeresetMocks()andawait usingdisposal.TestBed.sociable(Class).expose(Collaborator)keeps chosen class-keyed collaborators real (recursively, lifecycle included) while token-keyed dependencies stay mocked as the declared boundary;bed.exposed(Class)retrieves the real instances.