Open divmain opened 6 months ago
I've been taking a stab at this locally. Should this feature be built upon @salesforce/wire-service-jest-util ?
Possibly. That library is largely agnostic to the test runner in which it is invoked, despite the name. We are looking at this one actively right now, although it is proving to be tricky to solve. We may need to revisit some of the baseline mock functionality to really make this ergonomic.
I'd be interested to hear what experiments/thinking you've done on this subject. Would pulling in the Jest util meet your needs? Or are there particular improvements of functionality that you'd like to see?
@divmain I'm not sure. My priority was to get the wire decorator working and get closer to supporting the components I'm maintaining in prod.
I guess this issue is solved by #21 though.
Currently, there is no ergonomic way for a test author to mock the behavior of an
@wire
dependency. A mechanism should be built so that the test environment can directly call or modify the state of a mock, on a per-test basis. Once this is in place, an additional layer should be built on top of the first to enable a test to modify the behavior of a wire.Example component code:
Example test code: