4

After running the command mentioned in the question and checking the project structure again, I saw that a /coverage folder was automatically created that contains a lcov-report. So similar to what you might be used to from other UI frameworks. Looking at the Jest configuration, it seems to import a default configuration (also for coverage reporting). So ...


3

I suspect that this is mostly an issue of how you've chosen to share your code (i.e. what you've shared with us is not your actual code, and you've made some mistakes in trying to obfuscate your code), but... As written, that if block is impossible to enter and impossible to test. The local variable abc is not accessible from outside of myMethod(), so it ...


1

The general solution for coercing an exception is via dependency injection of a mock object that replaces a runtime object where the mock object: sets a field value such that the DML will fail throws an exception when the mock object is invoked This requires restructuring your code into Separation of Concerns patterns. A sophisticated one is the fflib ...


1

To answer the error question... This is one of those cases where the error correctly tells you what the issue is. ...row was retrieved via SOQL without querying the requested field: Contact.Account From Apex Developer Guide > Working with SOQL and SOSL Query Results https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/...


1

To me, the simplest approach I could think of, that ensures the event is actually being published (and fired), was to use the event's Trigger to set some static variables that the Test Class can access. This is similar to a trigger I have written for a similar use case (but obviously different variables): trigger MyEvent on MyEvent__e (after insert) { ...


Only top voted, non community-wiki answers of a minimum length are eligible