Closed jvilk closed 11 years ago
This is proving problematic for automated testing. None of Dropbox.js' auth drivers work with this setup. The redirect driver breaks Karma because it can't handle page reloads. The popup driver fails to do anything, and the Node driver only works for server applications where the Dropbox API calls are made within Node.
Until there's a way of delaying API calls until the async calls in the constructor have finished I can't see a way to test the Dropbox backend with Karma.
Yeah, I can make a way. We already asynchronously trigger karma to run, so I'd just have to fix up the test runner logic for async constructors.
Btw, there's a way to pregenerate credentials on the command line for unit testing. Check out the Cakefile for Dropbox-js; you might be able to use that logic.
Delaying this line should delay test kickoff/API usage: https://github.com/jvilk/BrowserFS/blob/master/test/zzz-test_def.js#L71
Alrighty. @lavelle and I have figured this out.
For Dropbox, the website handles authenticating with the Dropbox-js library, and is responsible for handing the authenticated client over to us.
For storage requests, we can handle doing this asynchronously through the constructor.
In the future, when we support multiple cloud storage backends, we could potentially have handy factory methods that can present the user with a choice of which cloud storage account they wish to use.
IndexedDB
requires the user to allow the webpage to store data on the current webpage,Dropbox
requires the user to log in...