Closed mirontoli closed 8 years ago
There were some errors in sputils.list functions. I am not sure how to fix them to satifsy travis :)
From what I can see, the CI build worked fine.
Would it be possible to test this in some way? I'm thinking we could at least stub the browser functionality, and check that the function does validation as expected. E.g. test that options.content
actually is validated in the function to be defined.
Also, I think we should use a more generic default file name (instead of "tolle.txt" =)
Thanks for the feedback. "tolle.txt" will be "download.txt" instead. I'll try to set up a test.
Now I have added a test that checks that an Error is thrown when content is not provided. Perhaps there is more that could be tested if we rewrite the function, but I don't know how, yet.
This is quite the difficult function to unit test, since it is heavily dependent on browser functionality and user interaction (like checking the downloaded file). Maybe we cannot test more than this, automatically. I think, regarding testing, the test you supplied is sufficient.
I've one more comment, though. the else
is on a new line like:
if (...) {
}
else {
}
To keep the style consistent, we should put the else
on the same line as }
as such:
if (...) {
} else {
}
as a relevant aside, we should perhaps include the rule disallowNewlineBeforeBlockStatements
in jscs, to catch these types of stylistic matters
the rule I was referring to is disallowKeywordsOnNewLine
Wow, that's perfectionism. I like it. I moved the "else" up to the } and I also added the rule disallowKeywordsOnNewLine
to the .jscs.json
.
@roobie can we merge it now?
I created a helper function for downloading a file, a csv file or text. This works even with utf-8 and opening it directly in Excel - a very common need in SharePoint development. An example is an "Export to Excel" button in Search based applications. Some more info can be found on my blog post: