summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2019-02-20 10:54:39 +0100
committerMorris Jobke <hey@morrisjobke.de>2019-02-20 15:46:19 +0100
commit2e76bc31a908b18bcd2377e44c55bf9bf21c8efd (patch)
tree2d62c64e4081c1e1899077751d3be7322ada4b2b /core
parent319a0f2e38cfe01e2871d48f53feebb567d1e081 (diff)
downloadnextcloud-server-2e76bc31a908b18bcd2377e44c55bf9bf21c8efd.tar.gz
nextcloud-server-2e76bc31a908b18bcd2377e44c55bf9bf21c8efd.zip
Add unit tests and provide better message
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'core')
-rw-r--r--core/js/setupchecks.js6
-rw-r--r--core/js/tests/specs/setupchecksSpec.js36
2 files changed, 39 insertions, 3 deletions
diff --git a/core/js/setupchecks.js b/core/js/setupchecks.js
index f7b291b4706..b1213c2c042 100644
--- a/core/js/setupchecks.js
+++ b/core/js/setupchecks.js
@@ -112,10 +112,10 @@
var afterCall = function(xhr) {
var messages = [];
if (expectedStatus.indexOf(xhr.status) === -1) {
- var docUrl = placeholderUrl.replace('PLACEHOLDER', 'admin-setup-well-known-URL');
+ var docUrl = placeholderUrl.replace('PLACEHOLDER', 'admin-nginx');
messages.push({
- msg: t('core', 'Your web server is not properly set up to resolve "{url}". Further information can be found in the <a target="_blank" rel="noreferrer noopener" href="{docLink}">documentation</a>.', { docLink: docUrl, url: url }),
- type: OC.SetupChecks.MESSAGE_TYPE_INFO
+ msg: t('core', 'Your web server is not properly set up to resolve "{url}". 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 target="_blank" rel="noreferrer noopener" href="{docLink}">documentation page</a>. On Nginx those are typically the lines starting with "location ~" that need an update.', { docLink: docUrl, url: url }),
+ type: OC.SetupChecks.MESSAGE_TYPE_WARNING
});
}
deferred.resolve(messages);
diff --git a/core/js/tests/specs/setupchecksSpec.js b/core/js/tests/specs/setupchecksSpec.js
index 05178a3e5cc..55122eda0f0 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');