New answers tagged

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 ...


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) { ...


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 ...


0

Ah, such is the danger of copy/pasting code. When debugging code, it often helps to start at the line where you got your error and start working backwards. So, filter.activeModelId gives you "variable does not exist". That could mean that filter isn't a variable, or activeModelId isn't a variable We see that filter is defined as a variable in your ...


0

We can use validation rules here. Check Contact validation rules which can fire at contact update. Create contact with those values which will be used to fire validation rule. So you can get DML exception here. if you don't have any validation rules to fire at Contact update. try to move these exception block code to separate method in the class and use it ...


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/...


0

Might be related to sharing rules. Removing with sharing from the helper class would be an easy way to tell - though that probably should not be the end solution.


Top 50 recent answers are included