diff options
author | Morris Jobke <hey@morrisjobke.de> | 2019-02-20 10:54:39 +0100 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2019-02-20 10:54:39 +0100 |
commit | faef05730a2fca6ca019f645685ad6a08839d71c (patch) | |
tree | e129e30e1aa5bed51632b66faf574e62cb395f39 /core/js/tests | |
parent | 6c9ea61758bc6bbed41dcb62cd1abd1a78d5e5e4 (diff) | |
download | nextcloud-server-faef05730a2fca6ca019f645685ad6a08839d71c.tar.gz nextcloud-server-faef05730a2fca6ca019f645685ad6a08839d71c.zip |
Add unit tests and provide better message
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'core/js/tests')
-rw-r--r-- | core/js/tests/specs/setupchecksSpec.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/core/js/tests/specs/setupchecksSpec.js b/core/js/tests/specs/setupchecksSpec.js index 6ea7d812d9a..e2c0053aa71 100644 --- a/core/js/tests/specs/setupchecksSpec.js +++ b/core/js/tests/specs/setupchecksSpec.js @@ -107,6 +107,42 @@ describe('OC.SetupChecks tests', function() { }); }); + describe('checkProviderUrl', function() { + it('should fail with another response status code than the expected one', function(done) { + var async = OC.SetupChecks.checkProviderUrl('/ocm-provider/', 'http://example.org/PLACEHOLDER', true); + + suite.server.requests[0].respond(302); + + async.done(function( data, s, x ){ + expect(data).toEqual([{ + msg: 'Your web server is not properly set up to resolve "/ocm-provider/". This is most likely related to a web server configuration that was not updated to deliver this folder directly. Please compare your configuration against the shipped rewrite rules in ".htaccess" for Apache or the provided one in the documentation for Nginx at it\'s <a href="http://example.org/admin-nginx" rel="noreferrer noopener">documentation page</a>. On Nginx those are typically the lines starting with "location ~" that need an update.', + type: OC.SetupChecks.MESSAGE_TYPE_WARNING + }]); + done(); + }); + }); + + it('should return no error with the expected response status code', function(done) { + var async = OC.SetupChecks.checkProviderUrl('/ocm-provider/', 'http://example.org/PLACEHOLDER', true); + + suite.server.requests[0].respond(200); + + async.done(function( data, s, x ){ + expect(data).toEqual([]); + done(); + }); + }); + + it('should return no error when no check should be run', function(done) { + var async = OC.SetupChecks.checkProviderUrl('/ocm-provider/', 'http://example.org/PLACEHOLDER', false); + + async.done(function( data, s, x ){ + expect(data).toEqual([]); + done(); + }); + }); + }); + describe('checkWOFF2Loading', function() { it('should fail with another response status code than the expected one', function(done) { var async = OC.SetupChecks.checkWOFF2Loading(OC.filePath('core', '', 'fonts/Nunito-Regular.woff2'), 'http://example.org/PLACEHOLDER'); |