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

Bug: Erroneous test setup due to the usage of contentChildren #8895

Open
LukasMachetanz opened this issue May 6, 2024 · 2 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@LukasMachetanz
Copy link

LukasMachetanz commented May 6, 2024

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?

@LukasMachetanz LukasMachetanz added the bug Something isn't working label May 6, 2024
@andreandersson
Copy link

Possibly duplicate of #8634

@LukasMachetanz
Copy link
Author

@andreandersson, definitely. I experienced the same problem with viewChild as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants