angular-localForage
angular-localForage copied to clipboard
setItem call does not return an angular promise but an ES6 promise

As per the screenshot above, the setItem call returns an ES6 promise instead of an angular promise. This is usually not a problem, unless you plan to use the finally call on the promise, in which case you get an error.
For the sake of consistency, we should wrap the ES6 promise inside an angular promise like so:
return $q.resolve(self._localforage.setItem(self.prefix() + key, localCopy))
@jairemix
Nice catch and sensible solution! Feel free to submit a PR, I'd be happy to review, merge, and release a patch version that fixes this.
After delving further, it turns out a number of modern browsers actually support the finally call as per the latest ECMAScript draft, so it's not always possible to distinguish between angular promises and native promises in unit tests through the finally call.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/finally
Would you suggest testing for angular promises using the (private) $$state property instead?