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

Setup methods #30

Merged
merged 4 commits into from
Jan 18, 2024
Merged

Setup methods #30

merged 4 commits into from
Jan 18, 2024

Conversation

remscodes
Copy link
Owner

  • Make ComponentTestBed configurable once outside the beforeEach setup.
  • Add tb.compileEach() to configure the test module for each tests.
  • Add tb.setup(..) to have the equivalent of the tb(..) but only for setup methods (only beforeEach and afterEach).

Example :

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

  tb.compileEach();

  beforeEach(tb.setup(({ component }) => {
    // (..) prepare common setup for the component
  }))

  it('should do something', tb(({ component }) => {
    // (..) component expectations
  }))

  it('should do something else', tb(({ component }) => {
    // (..) component others expectations
  }))
});

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

codecov bot commented Jan 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (105e752) 100.00% compared to head (30db3ca) 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #30   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           22        23    +1     
  Lines          106       121   +15     
  Branches        20        21    +1     
=========================================
+ Hits           106       121   +15     

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

@remscodes remscodes merged commit c29ca11 into main Jan 18, 2024
4 checks passed
@remscodes remscodes deleted the setup-methods branch January 18, 2024 14:19
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.

1 participant