Jest - localeForage.createInstance is not a function

Viewed 106

I am using localforage in an application, and I am exporting it, as part of a ContextProvider. The driver it uses is IndexDB. The problem is one component is using that Context and when I write tests for it, it needs to access that Context. And I get the following error:

TypeError: localForage.createInstance is not a function
    > 4 | const featureContextStore = localForage.createInstance({
        |                                        ^
      5 |   driver: localForage.INDEXEDDB,

Any idea how to solve it? I tried, spyOn, mock, defineDriver from localeForage itself. Nothing seems to work.

0 Answers
Related