Skip to content

fix(*): support same token to be injected twice#68

Merged
omermorad merged 4 commits into
nextfrom
fix/issue-67/same-class
Jul 1, 2023
Merged

fix(*): support same token to be injected twice#68
omermorad merged 4 commits into
nextfrom
fix/issue-67/same-class

Conversation

@omermorad

@omermorad omermorad commented Jun 30, 2023

Copy link
Copy Markdown
Collaborator

Description

In this pull request, significant changes have been made to the DependenciesReflector interface in the @automock/common package. The reflector has been updated to utilize tuples instead of the previous Map implementation for reflecting dependencies. This modification is crucial as it allows the reflector to effectively handle the injection of the same token or class multiple times, which was not feasible with the previous Map-based approach.

To ensure consistency and compatibility, corresponding changes have been made in the @automock/core and @automock/adapters.nestjs packages. These adjustments ensure that both packages now support the tuple-based type instead of relying on the previous Map-based implementation.

Closes #67

omermorad added 4 commits July 1, 2023 00:05
Refactor the `DependenciesReflector` in the common package to change its signature and return a different interface. This change was made to support both constructor parameters and properties. The motivation behind this change is to address a bug in the reflector where returning a Map does not allow dependencies to appear more than once.

Closes: #67

Please note that this is a breaking change.
BREAKING CHANGE: The `reflectDependencies` method of `DependenciesReflector` now returns a different interface to accommodate the support for both constructor parameters and properties.
…ndencies

Replace the data structure that stores the class dependencies after reflection.

Closes: #67
@omermorad omermorad force-pushed the fix/issue-67/same-class branch from c5347f3 to aed892b Compare July 1, 2023 05:19
@codecov-commenter

codecov-commenter commented Jul 1, 2023

Copy link
Copy Markdown

Codecov Report

Merging #68 (aed892b) into master (e2d6cfc) will decrease coverage by 0.19%.
The diff coverage is 100.00%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@            Coverage Diff             @@
##           master      #68      +/-   ##
==========================================
- Coverage   88.61%   88.42%   -0.19%     
==========================================
  Files           9        9              
  Lines         123      121       -2     
  Branches       13       13              
==========================================
- Hits          109      107       -2     
  Misses         11       11              
  Partials        3        3              
Flag Coverage Δ
adapters.nestjs 88.42% <100.00%> (-0.19%) ⬇️
core 88.42% <100.00%> (-0.19%) ⬇️
jest 88.42% <100.00%> (-0.19%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
packages/adapters/nestjs/src/reflector.service.ts 85.00% <100.00%> (-1.37%) ⬇️
packages/core/src/services/dependencies-mocker.ts 100.00% <100.00%> (ø)

@omermorad omermorad changed the base branch from master to next July 1, 2023 05:23
@omermorad omermorad merged commit 3e7f199 into next Jul 1, 2023
@omermorad omermorad deleted the fix/issue-67/same-class branch July 1, 2023 05:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Same token injected twice

2 participants