79682141

Date: 2025-06-27 15:02:06
Score: 6.5 🚩
Natty:
Report link

thank you @merlosy!

This Video really helped me, when I had a similar situation.
https://youtu.be/Jv7jOrGTKd0?si=kqvGSDOzs0oA-4Vx&t=434,

The strange thing is, that the official Angular Documentation suggests a method that doesn't work for me: https://angular.dev/guide/testing/components-scenarios#nested-component-tests

Only by adding

TestBed.overrideComponent(PrimaryComponent, {
            remove: { imports: [Child1Component, Child2Component, Child3Component] },
            add: { imports: [Mock1Component, Mock2Component, Mock3Component] },
        });
   

before

await TestBed.configureTestingModule(....)

was I able to mock the nested / child components correctly

Reasons:
  • Blacklisted phrase (0.5): thank you
  • Blacklisted phrase (1): youtu.be
  • Blacklisted phrase (1): This Video
  • RegEx Blacklisted phrase (2): doesn't work for me
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @merlosy
  • Low reputation (1):
Posted by: prezzler