mirror of https://gitee.com/bigwinds/arangodb
lots of tests , started dashboardView test
This commit is contained in:
parent
cac63cb9e7
commit
47433edfb1
|
@ -15,8 +15,7 @@
|
||||||
alreadyCalledDetailChart: [],
|
alreadyCalledDetailChart: [],
|
||||||
|
|
||||||
events: {
|
events: {
|
||||||
"click .dashboard-chart": "showDetail",
|
"click .dashboard-chart": "showDetail"
|
||||||
"click #backToCluster": "returnToClusterView"
|
|
||||||
},
|
},
|
||||||
|
|
||||||
tendencies: {
|
tendencies: {
|
||||||
|
@ -90,7 +89,6 @@
|
||||||
$('#modal-dialog').on('hidden', function () {
|
$('#modal-dialog').on('hidden', function () {
|
||||||
self.hidden();
|
self.hidden();
|
||||||
});
|
});
|
||||||
//$('.modal-body').css({"max-height": "100%" });
|
|
||||||
$('#modal-dialog').toggleClass("modal-chart-detail", true);
|
$('#modal-dialog').toggleClass("modal-chart-detail", true);
|
||||||
options.height = $('.modal-chart-detail').height() * 0.7;
|
options.height = $('.modal-chart-detail').height() * 0.7;
|
||||||
options.width = $('.modal-chart-detail').width() * 0.84;
|
options.width = $('.modal-chart-detail').width() * 0.84;
|
||||||
|
@ -579,11 +577,6 @@
|
||||||
this.updateTendencies();
|
this.updateTendencies();
|
||||||
}
|
}
|
||||||
this.startUpdating();
|
this.startUpdating();
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
returnToClusterView: function () {
|
|
||||||
window.history.back();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}());
|
}());
|
||||||
|
|
|
@ -255,6 +255,7 @@
|
||||||
"test/specs/views/graphViewSpec.js",
|
"test/specs/views/graphViewSpec.js",
|
||||||
"test/specs/views/documentsViewSpec.js",
|
"test/specs/views/documentsViewSpec.js",
|
||||||
"test/specs/views/documentViewSpec.js",
|
"test/specs/views/documentViewSpec.js",
|
||||||
|
"test/specs/views/dashboardViewSpec.js",
|
||||||
"test/specs/views/graphManagementViewSpec.js",
|
"test/specs/views/graphManagementViewSpec.js",
|
||||||
"test/specs/views/newLogsViewSpec.js",
|
"test/specs/views/newLogsViewSpec.js",
|
||||||
"test/specs/views/notificationViewSpec.js",
|
"test/specs/views/notificationViewSpec.js",
|
||||||
|
|
|
@ -1,25 +1,39 @@
|
||||||
/*jslint indent: 2, nomen: true, maxlen: 100, white: true plusplus: true */
|
/*jslint indent: 2, nomen: true, maxlen: 100, white: true plusplus: true */
|
||||||
/*global describe, it, expect, jasmine, spyOn, beforeEach*/
|
/*global describe, isCoordinator, versionHelper, window, it, expect, jasmine, spyOn, beforeEach*/
|
||||||
/*global $, d3, arangoHelper*/
|
/*global $, d3, arangoHelper*/
|
||||||
|
|
||||||
|
|
||||||
describe("Arango Helper", function() {
|
describe("Arango Helper", function () {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
describe("Checking collection types converter", function() {
|
describe("Checking collection types converter", function () {
|
||||||
|
|
||||||
var ajaxCB;
|
var ajaxCB;
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function () {
|
||||||
ajaxCB = function() {
|
ajaxCB = function (url, opts) {
|
||||||
|
if (url === "cluster/amICoordinator") {
|
||||||
|
expect(opts.async).toEqual(false);
|
||||||
|
opts.success(true);
|
||||||
|
} else if (url instanceof Object) {
|
||||||
|
opts = url;
|
||||||
|
if (opts.url === "/_api/database/current") {
|
||||||
|
expect(opts.type).toEqual("GET");
|
||||||
|
expect(opts.cache).toEqual(false);
|
||||||
|
expect(opts.async).toEqual(false);
|
||||||
|
expect(opts.contentType).toEqual("application/json");
|
||||||
|
expect(opts.processData).toEqual(false);
|
||||||
|
opts.success({result: {name: "blub"}});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
spyOn($, "ajax").andCallFake(function(opts) {
|
spyOn($, "ajax").andCallFake(function (url, opts) {
|
||||||
ajaxCB(opts);
|
ajaxCB(url, opts);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("if blank collection name", function() {
|
it("if blank collection name", function () {
|
||||||
var myObject = {},
|
var myObject = {},
|
||||||
dummy;
|
dummy;
|
||||||
myObject.name = "";
|
myObject.name = "";
|
||||||
|
@ -27,7 +41,7 @@ describe("Arango Helper", function() {
|
||||||
expect(dummy).toBe("-");
|
expect(dummy).toBe("-");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("if type document", function() {
|
it("if type document", function () {
|
||||||
var myObject = {},
|
var myObject = {},
|
||||||
dummy;
|
dummy;
|
||||||
myObject.type = 2;
|
myObject.type = 2;
|
||||||
|
@ -36,7 +50,7 @@ describe("Arango Helper", function() {
|
||||||
expect(dummy).toBe("document");
|
expect(dummy).toBe("document");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("if type edge", function() {
|
it("if type edge", function () {
|
||||||
var myObject = {},
|
var myObject = {},
|
||||||
dummy;
|
dummy;
|
||||||
myObject.type = 3;
|
myObject.type = 3;
|
||||||
|
@ -45,7 +59,7 @@ describe("Arango Helper", function() {
|
||||||
expect(dummy).toBe("edge");
|
expect(dummy).toBe("edge");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("if type unknown", function() {
|
it("if type unknown", function () {
|
||||||
var myObject = {},
|
var myObject = {},
|
||||||
dummy;
|
dummy;
|
||||||
myObject.type = Math.random();
|
myObject.type = Math.random();
|
||||||
|
@ -54,12 +68,117 @@ describe("Arango Helper", function() {
|
||||||
expect(dummy).toBe("unknown");
|
expect(dummy).toBe("unknown");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("is coordinatoor", function () {
|
||||||
|
var res;
|
||||||
|
res = isCoordinator();
|
||||||
|
expect(res).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("checking html escaping", function() {
|
it("versionHelper_toString", function () {
|
||||||
|
var res;
|
||||||
|
res = versionHelper.toString({
|
||||||
|
major: 2,
|
||||||
|
minor: 0,
|
||||||
|
patch: 1
|
||||||
|
});
|
||||||
|
expect(res).toEqual("2.0.1");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("currentDatabase with success", function () {
|
||||||
|
var res;
|
||||||
|
res = arangoHelper.currentDatabase();
|
||||||
|
expect(res).toEqual("blub");
|
||||||
|
});
|
||||||
|
it("currentDatabase with error", function () {
|
||||||
|
var res;
|
||||||
|
ajaxCB = function (opts) {
|
||||||
|
if (opts.url === "/_api/database/current") {
|
||||||
|
expect(opts.type).toEqual("GET");
|
||||||
|
expect(opts.cache).toEqual(false);
|
||||||
|
expect(opts.async).toEqual(false);
|
||||||
|
expect(opts.contentType).toEqual("application/json");
|
||||||
|
expect(opts.processData).toEqual(false);
|
||||||
|
opts.error({result: {name: "blub"}});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
res = arangoHelper.currentDatabase();
|
||||||
|
expect(res).toEqual(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("databaseAllowed with success", function () {
|
||||||
|
var res;
|
||||||
|
spyOn(arangoHelper, "currentDatabase").andReturn("blub");
|
||||||
|
ajaxCB = function (opts) {
|
||||||
|
expect(opts.url).toEqual("/_db/blub/_api/database/");
|
||||||
|
expect(opts.type).toEqual("GET");
|
||||||
|
expect(opts.cache).toEqual(false);
|
||||||
|
expect(opts.async).toEqual(false);
|
||||||
|
expect(opts.contentType).toEqual("application/json");
|
||||||
|
expect(opts.processData).toEqual(false);
|
||||||
|
opts.success();
|
||||||
|
};
|
||||||
|
res = arangoHelper.databaseAllowed();
|
||||||
|
expect(res).toEqual(true);
|
||||||
|
});
|
||||||
|
it("databaseAllowed with error", function () {
|
||||||
|
var res;
|
||||||
|
spyOn(arangoHelper, "currentDatabase").andReturn("blub");
|
||||||
|
ajaxCB = function (opts) {
|
||||||
|
expect(opts.url).toEqual("/_db/blub/_api/database/");
|
||||||
|
expect(opts.type).toEqual("GET");
|
||||||
|
expect(opts.cache).toEqual(false);
|
||||||
|
expect(opts.async).toEqual(false);
|
||||||
|
expect(opts.contentType).toEqual("application/json");
|
||||||
|
expect(opts.processData).toEqual(false);
|
||||||
|
opts.error();
|
||||||
|
};
|
||||||
|
res = arangoHelper.databaseAllowed();
|
||||||
|
expect(res).toEqual(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("arangoNotification", function () {
|
||||||
|
var res, notificationList = {
|
||||||
|
add: function () {
|
||||||
|
}
|
||||||
|
};
|
||||||
|
window.App = {
|
||||||
|
notificationList: notificationList
|
||||||
|
};
|
||||||
|
spyOn(notificationList, "add");
|
||||||
|
arangoHelper.arangoNotification("bla", "blub");
|
||||||
|
expect(notificationList.add).toHaveBeenCalledWith({title: "bla", content: "blub"});
|
||||||
|
arangoHelper.arangoError("bla", "blub");
|
||||||
|
expect(notificationList.add).toHaveBeenCalledWith({title: "bla", content: "blub"});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("randomToken", function () {
|
||||||
|
expect(arangoHelper.getRandomToken()).not.toEqual(undefined);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("collectionApiType", function () {
|
||||||
|
var adsDummy = {
|
||||||
|
getCollectionInfo: function () {
|
||||||
|
return {type: 3};
|
||||||
|
}
|
||||||
|
}, adsDummy2 = {
|
||||||
|
getCollectionInfo: function () {
|
||||||
|
return {type: 2};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
arangoHelper.arangoDocumentStore = adsDummy;
|
||||||
|
expect(arangoHelper.collectionApiType("blub", true)).toEqual("edge");
|
||||||
|
arangoHelper.arangoDocumentStore = adsDummy2;
|
||||||
|
expect(arangoHelper.collectionApiType("blub", true)).toEqual("document");
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("checking html escaping", function () {
|
||||||
var input = "<&>\"'",
|
var input = "<&>\"'",
|
||||||
expected = "<&>"'";
|
expected = "<&>"'";
|
||||||
expect(arangoHelper.escapeHtml(input)).toEqual(expected);
|
expect(arangoHelper.escapeHtml(input)).toEqual(expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*jslint indent: 2, nomen: true, maxlen: 100, white: true plusplus: true, browser: true*/
|
/*jslint indent: 2, nomen: true, maxlen: 100, white: true plusplus: true, browser: true*/
|
||||||
/*global describe, beforeEach, afterEach, Backbone, it, spyOn, expect*/
|
/*global describe, jasmine, beforeEach, afterEach, Backbone, it, spyOn, expect*/
|
||||||
/*global $*/
|
/*global $*/
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
|
@ -39,7 +39,7 @@
|
||||||
c : {
|
c : {
|
||||||
x : 2
|
x : 2
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
expect(col.mergeObjects(o1, o2, ["b", "c"])).toEqual(
|
expect(col.mergeObjects(o1, o2, ["b", "c"])).toEqual(
|
||||||
|
@ -68,7 +68,7 @@
|
||||||
b : {
|
b : {
|
||||||
x : 2
|
x : 2
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
expect(col.mergeObjects(o1, o2)).toEqual(
|
expect(col.mergeObjects(o1, o2)).toEqual(
|
||||||
|
@ -178,7 +178,8 @@
|
||||||
},
|
},
|
||||||
requests: {
|
requests: {
|
||||||
header: "Requests",
|
header: "Requests",
|
||||||
labels: ["datetime", "GET", "PUT", "POST", "DELETE", "PATCH", "HEAD", "OPTIONS", "OTHER"],
|
labels: ["datetime", "GET", "PUT", "POST", "DELETE",
|
||||||
|
"PATCH", "HEAD", "OPTIONS", "OTHER"],
|
||||||
stackedGraph: true,
|
stackedGraph: true,
|
||||||
div: "requestsChart"
|
div: "requestsChart"
|
||||||
},
|
},
|
||||||
|
@ -187,20 +188,31 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
expect(col.figureDependedOptions.clusterAverageRequestTime.axes.y.axisLabelFormatter(0)).toEqual(0);
|
expect(col.figureDependedOptions.clusterAverageRequestTime.axes.y.
|
||||||
expect(col.figureDependedOptions.clusterAverageRequestTime.axes.y.axisLabelFormatter(3.4567)).toEqual(3.46);
|
axisLabelFormatter(0)).toEqual(0);
|
||||||
expect(col.figureDependedOptions.clusterAverageRequestTime.axes.y.valueFormatter(3.4567)).toEqual(3.46);
|
expect(col.figureDependedOptions.clusterAverageRequestTime.axes.y.
|
||||||
|
axisLabelFormatter(3.4567)).toEqual(3.46);
|
||||||
|
expect(col.figureDependedOptions.clusterAverageRequestTime.axes.y.
|
||||||
|
valueFormatter(3.4567)).toEqual(3.46);
|
||||||
|
|
||||||
expect(col.figureDependedOptions.systemUserTime.axes.y.axisLabelFormatter(0)).toEqual(0);
|
expect(col.figureDependedOptions.systemUserTime.axes.y.
|
||||||
expect(col.figureDependedOptions.systemUserTime.axes.y.axisLabelFormatter(3.4567)).toEqual(3.46);
|
axisLabelFormatter(0)).toEqual(0);
|
||||||
expect(col.figureDependedOptions.systemUserTime.axes.y.valueFormatter(3.4567)).toEqual(3.46);
|
expect(col.figureDependedOptions.systemUserTime.axes.y.
|
||||||
|
axisLabelFormatter(3.4567)).toEqual(3.46);
|
||||||
|
expect(col.figureDependedOptions.systemUserTime.axes.y.
|
||||||
|
valueFormatter(3.4567)).toEqual(3.46);
|
||||||
|
|
||||||
expect(col.figureDependedOptions.totalTime.axes.y.axisLabelFormatter(0)).toEqual(0);
|
expect(col.figureDependedOptions.totalTime.axes.y.
|
||||||
expect(col.figureDependedOptions.totalTime.axes.y.axisLabelFormatter(3.4567)).toEqual(3.46);
|
axisLabelFormatter(0)).toEqual(0);
|
||||||
expect(col.figureDependedOptions.totalTime.axes.y.valueFormatter(3.4567)).toEqual(3.46);
|
expect(col.figureDependedOptions.totalTime.axes.y.
|
||||||
|
axisLabelFormatter(3.4567)).toEqual(3.46);
|
||||||
|
expect(col.figureDependedOptions.totalTime.axes.y.
|
||||||
|
valueFormatter(3.4567)).toEqual(3.46);
|
||||||
|
|
||||||
expect(col.figureDependedOptions.residentSize.axes.y.axisLabelFormatter(3.4567)).toEqual("346%");
|
expect(col.figureDependedOptions.residentSize.axes.y.
|
||||||
expect(col.figureDependedOptions.residentSize.axes.y.valueFormatter(3.4567)).toEqual("346%");
|
axisLabelFormatter(3.4567)).toEqual("346%");
|
||||||
|
expect(col.figureDependedOptions.residentSize.axes.y.
|
||||||
|
valueFormatter(3.4567)).toEqual("346%");
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -256,10 +268,12 @@
|
||||||
});
|
});
|
||||||
expect(res.div).toEqual("systemUserTimeChart");
|
expect(res.div).toEqual("systemUserTimeChart");
|
||||||
expect(res.header).toEqual("System and User Time");
|
expect(res.header).toEqual("System and User Time");
|
||||||
expect(res.labels).toEqual(["datetime", "System Time", "User Time"]);
|
expect(res.labels).toEqual(["datetime",
|
||||||
|
"System Time", "User Time"]);
|
||||||
expect(res.labelsDiv ).toEqual(null);
|
expect(res.labelsDiv ).toEqual(null);
|
||||||
expect(res.legend ).toEqual("always");
|
expect(res.legend ).toEqual("always");
|
||||||
expect(res.axes.x.valueFormatter(-1)).toEqual(col.xAxisFormat(-1));
|
expect(res.axes.x.valueFormatter(-1)).toEqual(
|
||||||
|
col.xAxisFormat(-1));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@ -288,7 +302,8 @@
|
||||||
expect(res.labelsKMG2 ).toEqual(false);
|
expect(res.labelsKMG2 ).toEqual(false);
|
||||||
expect(res.div).toEqual("pageFaultsChart");
|
expect(res.div).toEqual("pageFaultsChart");
|
||||||
expect(res.header).toEqual("Page Faults");
|
expect(res.header).toEqual("Page Faults");
|
||||||
expect(res.labels).toEqual(["datetime", "Major Page Faults", "Minor Page Faults"]);
|
expect(res.labels).toEqual(["datetime", "Major Page Faults",
|
||||||
|
"Minor Page Faults"]);
|
||||||
expect(res.legend ).toEqual("always");
|
expect(res.legend ).toEqual("always");
|
||||||
expect(res.visibility).toEqual([true, true]);
|
expect(res.visibility).toEqual([true, true]);
|
||||||
});
|
});
|
||||||
|
|
|
@ -2,22 +2,22 @@
|
||||||
/*global describe, beforeEach, afterEach, it, spyOn, expect, jasmine*/
|
/*global describe, beforeEach, afterEach, it, spyOn, expect, jasmine*/
|
||||||
/*global $, arangoHelper*/
|
/*global $, arangoHelper*/
|
||||||
|
|
||||||
(function() {
|
(function () {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
describe("Arango Collection Model", function() {
|
describe("Arango Collection Model", function () {
|
||||||
|
|
||||||
var myCollection;
|
var myCollection;
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function () {
|
||||||
myCollection = new window.arangoCollectionModel();
|
myCollection = new window.arangoCollectionModel();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("verifies urlRoot", function() {
|
it("verifies urlRoot", function () {
|
||||||
expect(myCollection.urlRoot).toEqual('/_api/collection');
|
expect(myCollection.urlRoot).toEqual('/_api/collection');
|
||||||
});
|
});
|
||||||
|
|
||||||
it("verifies defaults", function() {
|
it("verifies defaults", function () {
|
||||||
expect(myCollection.get('id')).toEqual('');
|
expect(myCollection.get('id')).toEqual('');
|
||||||
expect(myCollection.get('name')).toEqual('');
|
expect(myCollection.get('name')).toEqual('');
|
||||||
expect(myCollection.get('status')).toEqual('');
|
expect(myCollection.get('status')).toEqual('');
|
||||||
|
@ -26,15 +26,15 @@
|
||||||
expect(myCollection.get('picture')).toEqual('');
|
expect(myCollection.get('picture')).toEqual('');
|
||||||
});
|
});
|
||||||
|
|
||||||
it("verifies set defaults", function() {
|
it("verifies set defaults", function () {
|
||||||
var name = 'blub',
|
var name = 'blub',
|
||||||
status = 'active',
|
status = 'active',
|
||||||
type = 'myType';
|
type = 'myType';
|
||||||
myCollection = new window.arangoCollectionModel(
|
myCollection = new window.arangoCollectionModel(
|
||||||
{
|
{
|
||||||
name : name,
|
name: name,
|
||||||
status : status,
|
status: status,
|
||||||
type : type
|
type: type
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
expect(myCollection.get('id')).toEqual('');
|
expect(myCollection.get('id')).toEqual('');
|
||||||
|
@ -45,15 +45,15 @@
|
||||||
expect(myCollection.get('picture')).toEqual('');
|
expect(myCollection.get('picture')).toEqual('');
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("checking ajax", function() {
|
describe("checking ajax", function () {
|
||||||
var url, type, shouldFail, successResult, failResult, id, data;
|
var url, type, shouldFail, successResult, failResult, id, data;
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function () {
|
||||||
id = "4711";
|
id = "4711";
|
||||||
successResult = "success";
|
successResult = "success";
|
||||||
failResult = "fail";
|
failResult = "fail";
|
||||||
myCollection.set('id', id);
|
myCollection.set('id', id);
|
||||||
spyOn($, "ajax").andCallFake(function(opt) {
|
spyOn($, "ajax").andCallFake(function (opt) {
|
||||||
expect(opt.url).toEqual(url);
|
expect(opt.url).toEqual(url);
|
||||||
expect(opt.type).toEqual(type);
|
expect(opt.type).toEqual(type);
|
||||||
expect(opt.success).toEqual(jasmine.any(Function));
|
expect(opt.success).toEqual(jasmine.any(Function));
|
||||||
|
@ -69,93 +69,93 @@
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("getProperties", function() {
|
describe("getProperties", function () {
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function () {
|
||||||
url = "/_api/collection/" + id + "/properties";
|
url = "/_api/collection/" + id + "/properties";
|
||||||
type = "GET";
|
type = "GET";
|
||||||
});
|
});
|
||||||
|
|
||||||
it("success", function() {
|
it("success", function () {
|
||||||
shouldFail = false;
|
shouldFail = false;
|
||||||
expect(myCollection.getProperties()).toEqual(successResult);
|
expect(myCollection.getProperties()).toEqual(successResult);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("fail", function() {
|
it("fail", function () {
|
||||||
shouldFail = true;
|
shouldFail = true;
|
||||||
expect(myCollection.getProperties()).toEqual(failResult);
|
expect(myCollection.getProperties()).toEqual(failResult);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("getFigures", function() {
|
describe("getFigures", function () {
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function () {
|
||||||
url = "/_api/collection/" + id + "/figures";
|
url = "/_api/collection/" + id + "/figures";
|
||||||
type = "GET";
|
type = "GET";
|
||||||
});
|
});
|
||||||
|
|
||||||
it("success", function() {
|
it("success", function () {
|
||||||
shouldFail = false;
|
shouldFail = false;
|
||||||
expect(myCollection.getFigures()).toEqual(successResult);
|
expect(myCollection.getFigures()).toEqual(successResult);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("fail", function() {
|
it("fail", function () {
|
||||||
shouldFail = true;
|
shouldFail = true;
|
||||||
expect(myCollection.getFigures()).toEqual(failResult);
|
expect(myCollection.getFigures()).toEqual(failResult);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("getRevision", function() {
|
describe("getRevision", function () {
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function () {
|
||||||
url = "/_api/collection/" + id + "/revision";
|
url = "/_api/collection/" + id + "/revision";
|
||||||
type = "GET";
|
type = "GET";
|
||||||
});
|
});
|
||||||
|
|
||||||
it("success", function() {
|
it("success", function () {
|
||||||
shouldFail = false;
|
shouldFail = false;
|
||||||
expect(myCollection.getRevision()).toEqual(successResult);
|
expect(myCollection.getRevision()).toEqual(successResult);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("fail", function() {
|
it("fail", function () {
|
||||||
shouldFail = true;
|
shouldFail = true;
|
||||||
expect(myCollection.getRevision()).toEqual(failResult);
|
expect(myCollection.getRevision()).toEqual(failResult);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("getFigures", function() {
|
describe("getFigures", function () {
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function () {
|
||||||
url = "/_api/index/?collection=" + id;
|
url = "/_api/index/?collection=" + id;
|
||||||
type = "GET";
|
type = "GET";
|
||||||
});
|
});
|
||||||
|
|
||||||
it("success", function() {
|
it("success", function () {
|
||||||
shouldFail = false;
|
shouldFail = false;
|
||||||
expect(myCollection.getIndex()).toEqual(successResult);
|
expect(myCollection.getIndex()).toEqual(successResult);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("fail", function() {
|
it("fail", function () {
|
||||||
shouldFail = true;
|
shouldFail = true;
|
||||||
expect(myCollection.getIndex()).toEqual(failResult);
|
expect(myCollection.getIndex()).toEqual(failResult);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("loadCollection", function() {
|
describe("loadCollection", function () {
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function () {
|
||||||
url = "/_api/collection/" + id + "/load";
|
url = "/_api/collection/" + id + "/load";
|
||||||
type = "PUT";
|
type = "PUT";
|
||||||
});
|
});
|
||||||
|
|
||||||
it("success", function() {
|
it("success", function () {
|
||||||
shouldFail = false;
|
shouldFail = false;
|
||||||
spyOn(arangoHelper, "arangoNotification");
|
spyOn(arangoHelper, "arangoNotification");
|
||||||
myCollection.loadCollection();
|
myCollection.loadCollection();
|
||||||
expect(myCollection.get("status")).toEqual("loaded");
|
expect(myCollection.get("status")).toEqual("loaded");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("fail", function() {
|
it("fail", function () {
|
||||||
shouldFail = true;
|
shouldFail = true;
|
||||||
spyOn(arangoHelper, "arangoError");
|
spyOn(arangoHelper, "arangoError");
|
||||||
myCollection.loadCollection();
|
myCollection.loadCollection();
|
||||||
|
@ -163,21 +163,21 @@
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("unloadCollection", function() {
|
describe("unloadCollection", function () {
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function () {
|
||||||
url = "/_api/collection/" + id + "/unload";
|
url = "/_api/collection/" + id + "/unload";
|
||||||
type = "PUT";
|
type = "PUT";
|
||||||
});
|
});
|
||||||
|
|
||||||
it("success", function() {
|
it("success", function () {
|
||||||
shouldFail = false;
|
shouldFail = false;
|
||||||
spyOn(arangoHelper, "arangoNotification");
|
spyOn(arangoHelper, "arangoNotification");
|
||||||
myCollection.unloadCollection();
|
myCollection.unloadCollection();
|
||||||
expect(myCollection.get("status")).toEqual("unloaded");
|
expect(myCollection.get("status")).toEqual("unloaded");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("fail", function() {
|
it("fail", function () {
|
||||||
shouldFail = true;
|
shouldFail = true;
|
||||||
spyOn(arangoHelper, "arangoError");
|
spyOn(arangoHelper, "arangoError");
|
||||||
myCollection.unloadCollection();
|
myCollection.unloadCollection();
|
||||||
|
@ -185,34 +185,42 @@
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("renameCollection", function() {
|
describe("renameCollection", function () {
|
||||||
|
|
||||||
var name;
|
var name;
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function () {
|
||||||
name = "newname";
|
name = "newname";
|
||||||
url = "/_api/collection/" + id + "/rename";
|
url = "/_api/collection/" + id + "/rename";
|
||||||
type = "PUT";
|
type = "PUT";
|
||||||
data = JSON.stringify({name: name});
|
data = JSON.stringify({name: name});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("success", function() {
|
it("success", function () {
|
||||||
shouldFail = false;
|
shouldFail = false;
|
||||||
expect(myCollection.renameCollection(name)).toBeTruthy();
|
expect(myCollection.renameCollection(name)).toBeTruthy();
|
||||||
expect(myCollection.get("name")).toEqual(name);
|
expect(myCollection.get("name")).toEqual(name);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("fail", function() {
|
it("fail", function () {
|
||||||
shouldFail = true;
|
shouldFail = true;
|
||||||
expect(myCollection.renameCollection(name)).toBeFalsy();
|
expect(myCollection.renameCollection(name)).toBeFalsy();
|
||||||
expect(myCollection.get("name")).not.toEqual(name);
|
expect(myCollection.get("name")).not.toEqual(name);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("fail with parseable error message", function () {
|
||||||
|
shouldFail = true;
|
||||||
|
failResult = {responseText : '{"errorMessage" : "bla"}'};
|
||||||
|
expect(myCollection.renameCollection(name)).toEqual("bla");
|
||||||
|
expect(myCollection.get("name")).not.toEqual(name);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("changeCollection", function() {
|
});
|
||||||
|
|
||||||
|
describe("changeCollection", function () {
|
||||||
var wfs, jns;
|
var wfs, jns;
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function () {
|
||||||
wfs = true;
|
wfs = true;
|
||||||
jns = 10 * 100 * 1000;
|
jns = 10 * 100 * 1000;
|
||||||
url = "/_api/collection/" + id + "/properties";
|
url = "/_api/collection/" + id + "/properties";
|
||||||
|
@ -220,15 +228,20 @@
|
||||||
data = JSON.stringify({waitForSync: wfs, journalSize: jns});
|
data = JSON.stringify({waitForSync: wfs, journalSize: jns});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("success", function() {
|
it("success", function () {
|
||||||
shouldFail = false;
|
shouldFail = false;
|
||||||
expect(myCollection.changeCollection(wfs, jns)).toBeTruthy();
|
expect(myCollection.changeCollection(wfs, jns)).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("fail", function() {
|
it("fail", function () {
|
||||||
shouldFail = true;
|
shouldFail = true;
|
||||||
expect(myCollection.changeCollection(wfs, jns)).toBeFalsy();
|
expect(myCollection.changeCollection(wfs, jns)).toBeFalsy();
|
||||||
});
|
});
|
||||||
|
it("fail with parseable error message", function () {
|
||||||
|
shouldFail = true;
|
||||||
|
failResult = {responseText : '{"errorMessage" : "bla"}'};
|
||||||
|
expect(myCollection.changeCollection(wfs, jns)).toEqual("bla");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -83,10 +83,10 @@
|
||||||
done : function(f) {
|
done : function(f) {
|
||||||
f();
|
f();
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
});
|
});
|
||||||
var result = cp.storeCredentials("name", "pw");
|
var result = cp.storeCredentials("name", "pw");
|
||||||
expect(cp.fetch).toHaveBeenCalled()
|
expect(cp.fetch).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("isSymmetricSetup with asymmetrical setup", function () {
|
it("isSymmetricSetup with asymmetrical setup", function () {
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue