Closed gustavnikolaj closed 8 years ago
This is amazing, thank you so so much @gustavnikolaj! No pressure at all on the comments, happy to merge this in manually and do some tweaks here too. I really like the UI Factory pattern... will have to bring this across to jspm at some point :)
I tried to follow up on all the comments that you had. I'll wait doing more until I've heard back from you on that.
If you want, I can fix the cases where we expected a rejected promise instead of a fulfilled one with the value undefined. Or we can wait doing that until after it's merged. That's up to you.
I'm glad that you liked the uiFactory. It was the most elegant way I could come up with to mock up the ui interaction, while at the meantime making sure that it's called in the way that you expect. We can easily make a module out of the uiFactory, for reuse in other modules, and even polish it up a bit so it's more general.
On second thoughts, that case is probably fine. Were there any other cases that you thought seemed like incorrect behaviours? Let me know. If not, then let's merge this.
There were two cases, but both being different variants of the same. Shouldn't it return the _auth data instead of undefined then?
Ah, yes you're completely right.
I'll fix that later today and then it'll be ready for merging, I think :-)
Done :-)
Thanks so much for your work on this!
You're very welcome. :-) If you have any questions or need a hand with testing in other areas of the project, please don't hesitate to reach out!
Thanks Gustav, it's very much needed so may well do that!
As promised, here is my take on testing this project.
When checking out this branch, first run
npm install
to get the new development dependencies. Then runningmocha
or./node_modules/.bin/mocha
will run the new tests for lib/auth.js. Alternatively, you can run the tests through instanbul by runningnpm run coverage
and then, the generated coverage report can be found at ./coverage/lcov-report/index.html.If you have any questions please don't hesitate to reach out here, or on gitter, if you prefer.
I'm using the unexpected assertion framework. It goes hand-in-hand with mocha quite nicely, and gives a really nice API for async assertions, based on promises.