ng-mocks
ng-mocks copied to clipboard
Bug: Erroneous test setup due to the usage of contentChildren
Description of the bug
Let's assume having a component SystemUnderTestComponent
as the SUT. This component internally renders ActionsComponent
, which will be mocked within the test setup. ActionsComponent
uses the new API contentChildren
for accessing its content children. Unfortunately this API causes problems for SystemUnderTestComponent
as the following error is thrown: TypeError: Cannot read properties of undefined (reading 'Symbol(SIGNAL)')
.
An example of the bug
https://codesandbox.io/p/sandbox/competent-fermat-llrjgt?file=%2Fsrc%2Ftest.spec.ts%3A35%2C35
Expected behavior
I would expect that the tests of SystemUnderTestComponent
are not influenced by internals of the mocked component ActionsComponent
.
Maybe this behavior is caused by the fact that ActionsComponent
is mocked and Angular can't find ActionComponent
?