We have, in the constructor of AppComponent, a function that loads some variables and sets them in the environment.ts file. But our tests fail because it uses those variables and run individually and it doesn't load AppComponent which sets them.
Is there a way to make AppComponent load/construct before a test runs?
If you would like to run code before the test, you should put it in a beforeAll code.
I don't undarstand why would you change the static configuration from app component, it sounds wrong.
The configuration is either static, then it will be set in environment file and won't change, or it's dynamic, then you should create a service, which you can read from easily, and test properly...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With