Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(gatsby): update cache.set to resolve with set value (#11327)
<!-- Have any questions? Check out the contributing docs at https://gatsby.app/contribute, or ask in this Pull Request and a Gatsby maintainer will be happy to help :) --> ## Description <!-- Write a brief description of the changes introduced by this PR --> Cache set method will now resolve to the stored value. Also, I have never written Jest tests so this was a pretty exciting learning experience. Mocking was not very intuitive, especially due to the resolve function being in the callback of the get and set cache manager package. We also don't actually talk to the cache so the get tests feel a little wonky. Also, I do not know the shape of the error object sent from the cache manager or what actually can cause it so I mocked its existence with `!undefined` which is obviously just `true` but I wanted it to read as something that was defined and not just true. Is there a better/conventional way to say `err` is defined? Would `{}` be a better solution? Interested if anyone has a better testing strategy than just forcing the error argument to exist or not. ## Related Issues <!-- Link to the issue that is fixed by this PR (if there is one) e.g. Fixes #1234, Addresses #1234, Related to #1234, etc. --> Addresses #11275
- Loading branch information