Skip to content
Snippets Groups Projects
Commit 9ebc6722 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

validator to projectId added

parent 9a7bb8e6
No related branches found
No related tags found
1 merge request!157validator to projectId added
Pipeline #
This diff is collapsed.
......@@ -4,6 +4,8 @@ require("../../mocha-config");
var AddProjectDialog = require('../../../../main/js/gui/admin/AddProjectDialog');
var ServerConnector = require('../../ServerConnector-mock');
var ValidationError = require('../../../../main/js/ValidationError');
var logger = require('../../logger');
......@@ -155,4 +157,45 @@ describe('AddProjectDialog', function () {
});
});
describe('checkValidity', function () {
it('invalid project name', function () {
var dialog = new AddProjectDialog({
element: testDiv,
customMap: null
});
var file = new Blob(["<node></node>"]);
file.name = "test.xml";
return dialog.init().then(function () {
return dialog.callListeners("onFileUpload", file);
}).then(function () {
dialog.setProjectId("(invalid id)");
return dialog.checkValidity().then(function () {
assert.notOk("Expected validity to reject");
}).catch(function(error){
assert.ok(error instanceof ValidationError);
});
}).then().finally(function () {
return dialog.destroy();
});
});
it('valid project name', function () {
var dialog = new AddProjectDialog({
element: testDiv,
customMap: null
});
var file = new Blob(["<node></node>"]);
file.name = "test.xml";
return dialog.init().then(function () {
return dialog.callListeners("onFileUpload", file);
}).then(function () {
dialog.setProjectId("-valid_id");
return dialog.checkValidity();
}).then().finally(function () {
return dialog.destroy();
});
});
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment