You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to check expect(apexMethod).toHaveBeenCalled() and .toHaveBeenCalledWith() while using @lwc/transformer however, i'm unable to utilise the provided mocked methods. Not sure if i'm missing something here. Currently looking at apex methods called imperatively not using wire.
expect(received).toHaveBeenCalled()
Matcher error: received value must be a mock or spy function
Received has type: function
Received has value: [Function apexMethod]
I can manually mock in each test but I'm looking to avoid that where possible
It seems to me the @lwc/jest-transformer incorrectly returns a function for @salesforce/apex/Class.method imports rather than a jest.fn().
This requires every test to mock every apex import. I'll raise a PR with what seems to me a simple way to resolve this. But i'll need guidance from some of the contibuters if this will be fix for a change
I'm trying to check
expect(apexMethod).toHaveBeenCalled()
and.toHaveBeenCalledWith()
while using@lwc/transformer
however, i'm unable to utilise the provided mocked methods. Not sure if i'm missing something here. Currently looking at apex methods called imperatively not using wire.Source
Test expect
Error
I can manually mock in each test but I'm looking to avoid that where possible
The text was updated successfully, but these errors were encountered: