Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ComponentTestBed inject(..) method #26

Merged
merged 5 commits into from
Jan 16, 2024
Merged

Add ComponentTestBed inject(..) method #26

merged 5 commits into from
Jan 16, 2024

Conversation

remscodes
Copy link
Owner

@remscodes remscodes commented Jan 16, 2024

tb.inject(name, token) alows to store injection into the ComponentTestBed and to retrieve it into the ComponentTools.injected param by autocompletion.

Example :

describe('AppComponent', () => {
  const tb = componentTestBed(AppComponent)
    .provide(AppService)
    .inject('service', AppService);

  tb.compileEach();
  tb.shouldCreate();

  it('should do something with service', tb(({ component, injected: { service } }) => {
    // ( ..) service expectations
  }));
});

@remscodes remscodes self-assigned this Jan 16, 2024
Copy link

codecov bot commented Jan 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (24c7e3a) 100.00% compared to head (91f119b) 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #26   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           20        22    +2     
  Lines           87       106   +19     
  Branches        20        20           
=========================================
+ Hits            87       106   +19     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@remscodes remscodes merged commit 105e752 into main Jan 16, 2024
4 checks passed
@remscodes remscodes deleted the inject-method branch January 16, 2024 23:33
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.

None yet

1 participant