In my App, I want to implement Unit-Tests via "Cypress Component Tests". There is a lot of information about how to write Tests for Angular COMPONENTS using e.g. the cy.mount() command.
However, Im looking for information, on how to tests service-classes. I can't find any inforamtion about that topic.
Can you help me whith that?
Greetings!
Testing the functionality (internals) of Angular services is given here app/demo/demo.spec.ts
All the example tests run in Cypress, except the last which uses
jasmine.createSpyObj
, but you could substitute the Cypress spy or stub commands.You would (maybe) also want to test service integration with a component, which is shown here Imports/Declarations/Providers where
DataService
is the service to be tested.After mounting you can check the effect on the component, for example does the component display the data provided by the
DataService
.