hoodiehq / hoodie-connection-status

:dog: connection status API for the browser
Apache License 2.0
5 stars 10 forks source link

connectionStatus.reset aborts pending request #25

Closed nathanstilwell closed 8 years ago

nathanstilwell commented 8 years ago

This is work in progress. The commits will be rebased with appropriate commit messages and documentation later.

closes #21

gr2m commented 8 years ago

@nathanstilwell I know why you got stuck now, it’s complicated :tm: I'll fix it up and we can discuss changes then

gr2m commented 8 years ago

The problem was that we used a promise in check.js that we could not mock. We could mock the nets call, but then the reject() / resolve() calls wouldn’t happen in its callback, and the Promise returned by .check() would remain pending.

So what I did is to move the nets call into a utils module, so we could mock it entirely. And then add some magic to add the .abort method to the promise. So state.request is now the promise returned by our lib/utils/request.js, and we set promise.abort in there.

Does that all make sense?

gr2m commented 8 years ago

I finished this up, hope you don’t mind @nathanstilwell. We got more starter issues if you’d like contribute again :) http://go.hood.ie/hoodie-starter-issues

nathanstilwell commented 8 years ago

Hey @gr2m. Not worries. Life got in the way and I timed out on this issue. Once things settle, I'm looking forward to digging back in to contributing.

gr2m commented 8 years ago

Looking forward to hear back from you, whenever you feel like it :)