Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Pallets can have unit tests with a mock runtime where extrinsics are tested against multiple cases.
However it's not obvious how to do the same for offchain workers.
How can I write unit tests for offchain workers?
You need something like this to register the offchain ext.
It's a really good example. Check the whole tests.rs.
Required, but never shown