From b46517f0129345e2199e160c73f418a0db1d509f Mon Sep 17 00:00:00 2001 From: Thomas Müller Date: Thu, 6 Mar 2014 00:26:57 +0100 Subject: adding js unit tests for OC.generateUrl() --- core/js/tests/specs/coreSpec.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'core/js') diff --git a/core/js/tests/specs/coreSpec.js b/core/js/tests/specs/coreSpec.js index 478505e9287..d69e1fc7e25 100644 --- a/core/js/tests/specs/coreSpec.js +++ b/core/js/tests/specs/coreSpec.js @@ -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'); + }); + }); }); -- cgit v1.2.3