]> source.dussan.org Git - nextcloud-server.git/commitdiff
adding js unit tests for OC.generateUrl()
authorThomas Müller <thomas.mueller@tmit.eu>
Wed, 5 Mar 2014 23:26:57 +0000 (00:26 +0100)
committerThomas Müller <thomas.mueller@tmit.eu>
Wed, 5 Mar 2014 23:26:57 +0000 (00:26 +0100)
core/js/tests/specs/coreSpec.js

index 478505e928767fb7fd2aa190a76451b8b7e54848..d69e1fc7e253c6f5427bf38f42c3c6f4f212d872 100644 (file)
@@ -276,5 +276,14 @@ describe('Core base tests', function() {
                });
 
        });
+       describe('Generate Url', function() {
+               it('returns absolute urls', function() {
+                       expect(OC.generateUrl('heartbeat')).toEqual(OC.webroot + '/index.php/heartbeat');
+                       expect(OC.generateUrl('/heartbeat')).toEqual(OC.webroot + '/index.php/heartbeat');
+               });
+               it('substitutes parameters', function() {
+                       expect(OC.generateUrl('apps/files/download{file}', {file: '/Welcome.txt'})).toEqual(OC.webroot + '/index.php/apps/files/download/Welcome.txt');
+               });
+       });
 });