[ 
https://issues.apache.org/jira/browse/CB-671?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13270954#comment-13270954
 ] 

Jesse MacFadyen commented on CB-671:
------------------------------------

Part of the point was that the tests should contain more descriptive 
information.
The test is described as : "resolve invalid URL"
The test verifies that 
window.resolveLocalFileSystemURI("/this.is.not.a.valid.url",...) causes an 
ENCODING_ERR.
But why is this NOT a valid url?: "/this.is.not.a.valid.url"
Why is this an ENCODING_ERR?

Currently, when I have a failing test, I have to parse the test to determine if 
it is a valid test, then I have to go to the docs and verify that the test 
proves the documented functionality, then usually jump over and read a W3C spec 
or 2, then get down to fixing the implementation.

Wherever possible, a better description would save a ton of time, ie 

it("resolve non-existent URL causes ENCODING_ERR", ... )

This I could easily parse and realize that, no, wait, that should be a 
NOT_FOUND_ERR so there is an issue with the test ... and just fix the test.

Regardless, I will fix it.
                
> Tests should be described in enough detail to explain what specifically they 
> are testing.
> -----------------------------------------------------------------------------------------
>
>                 Key: CB-671
>                 URL: https://issues.apache.org/jira/browse/CB-671
>             Project: Apache Cordova
>          Issue Type: Improvement
>          Components: mobile-spec
>            Reporter: Jesse MacFadyen
>            Assignee: Filip Maj
>            Priority: Minor
>
> The following test is supposed to fail, however it is not clear why ...
> Upon digging deeper, it appears that it is actually supposed to return a 
> FileError.NOT_FOUND_ERR, but there is no way to know for sure, short of 
> asking whoever wrote it.
> Code from : 
> https://github.com/apache/incubator-cordova-mobile-spec/blob/master/autotest/tests/file.tests.js#L255
> it("resolve invalid URL", function() {
>   var fail = jasmine.createSpy().andCallFake(function(error) {
>       expect(error).toBeDefined();
>       expect(error.code).toBe(FileError.ENCODING_ERR);
>   }),
>   win = createWin('window.resolveLocalFileSystemURI');
>   // lookup file system entry
>   runs(function() {
>     window.resolveLocalFileSystemURI("/this.is.not.a.valid.url", win, fail);
>   });
>   waitsFor(function() { return fail.wasCalled; }, "error callback never 
> called", Tests.TEST_TIMEOUT);
>   runs(function() {
>      expect(fail).toHaveBeenCalled();
>      expect(win).not.toHaveBeenCalled();
>    });
> });

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to