8

In How to mock or configure lightning:workspaceAPI in Lightning Testing Service (LTS) tests? the answer suggests using Jasmine's spyOn to call a fake function in a test and so work-around an API that isn't present in the LTS context.

From Googling I don't see a (supported) way to access the helper functions so using spyOn to fake there doesn't look possible. So I'm thinking that I'm going to have to move an inherited function from the helper to the controller to use spyOn. Is that correct?

PS

To save changing quite a lot of code I have added this as an equivalent of the Apex Test.isRunningTest for now (where $T is added by LTS):

    if (typeof $T !== "undefined") {
        // LTS version of code
    } else {
        // Production versions of code
    }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.