mirror of https://gitee.com/bigwinds/arangodb
Fixed Document statistic spec and JSLint
This commit is contained in:
parent
f44ebf0953
commit
d8889bc6a7
|
@ -201,70 +201,6 @@
|
|||
|
||||
});
|
||||
|
||||
it("should getStatisticsHistory", function () {
|
||||
spyOn($, "ajax").andCallFake(function (opt) {
|
||||
expect(opt.type).toEqual("POST");
|
||||
expect(opt.url).toEqual("/_admin/history");
|
||||
expect(opt.contentType).toEqual("application/json");
|
||||
expect(opt.cache).toEqual(false);
|
||||
expect(opt.async).toEqual(false);
|
||||
expect(opt.beforeSend).toNotBe(undefined);
|
||||
expect(opt.data).toEqual(JSON.stringify(
|
||||
{figures: ["bytesSend, totalTime"]}));
|
||||
opt.success({result: [
|
||||
{bytesSend: 1, totalTime: 2, time: 4},
|
||||
{bytesSend: 2, totalTime: 2, time: 4},
|
||||
{bytesSend: 3, totalTime: 2, time: 4}
|
||||
]
|
||||
});
|
||||
});
|
||||
var result = col.getStatisticsHistory(
|
||||
{figures: ["bytesSend, totalTime"]});
|
||||
expect(JSON.stringify(col.history)).toEqual(JSON.stringify([
|
||||
{bytesSend: 1, totalTime: 2, time: 4},
|
||||
{bytesSend: 2, totalTime: 2, time: 4},
|
||||
{bytesSend: 3, totalTime: 2, time: 4}
|
||||
]));
|
||||
});
|
||||
|
||||
it("should getStatisticsHistory from remote dispatcher and get an error", function () {
|
||||
delete col.history;
|
||||
spyOn($, "ajax").andCallFake(function (opt) {
|
||||
expect(opt.type).toEqual("POST");
|
||||
expect(opt.url).toEqual("endpoint/_admin/history");
|
||||
expect(opt.contentType).toEqual("application/json");
|
||||
expect(opt.cache).toEqual(false);
|
||||
expect(opt.async).toEqual(false);
|
||||
expect(opt.beforeSend).toNotBe(undefined);
|
||||
expect(opt.data).toEqual(JSON.stringify({
|
||||
figures: ["bytesSend, totalTime"]}));
|
||||
opt.error();
|
||||
});
|
||||
var result = col.getStatisticsHistory({server: {endpoint: "endpoint", isDBServer: false,
|
||||
addAuth: "authKey"},
|
||||
startDate: 15000, endDate: 18000, figures: ["bytesSend, totalTime"]});
|
||||
expect(col.history).toEqual(undefined);
|
||||
});
|
||||
|
||||
it("should getStatisticsHistory from remote dbserver and get an error", function () {
|
||||
delete col.history;
|
||||
spyOn($, "ajax").andCallFake(function (opt) {
|
||||
expect(opt.type).toEqual("POST");
|
||||
expect(opt.url).toEqual("endpoint/_admin/history?DBserver=anotherserver");
|
||||
expect(opt.contentType).toEqual("application/json");
|
||||
expect(opt.cache).toEqual(false);
|
||||
expect(opt.async).toEqual(false);
|
||||
expect(opt.beforeSend).toNotBe(undefined);
|
||||
expect(opt.data).toEqual(JSON.stringify({
|
||||
figures: ["bytesSend, totalTime"]}));
|
||||
opt.error();
|
||||
});
|
||||
var result = col.getStatisticsHistory({server: {endpoint: "endpoint", isDBServer: true,
|
||||
addAuth: "authKey", target: "anotherserver"}, startDate: 15000, endDate: 18000,
|
||||
figures: ["bytesSend, totalTime"]});
|
||||
expect(col.history).toEqual(undefined);
|
||||
});
|
||||
|
||||
it("start succesful Upload mit XHR ready state = 4, " +
|
||||
"XHR status = 201 and parseable JSON", function () {
|
||||
spyOn($, "ajax").andCallFake(function (opt) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*jslint indent: 2, nomen: true, maxlen: 100, white: true plusplus: true, browser: true*/
|
||||
/*global describe, beforeEach, afterEach, it, spyOn, expect, jQuery, _, jqconsole, $*/
|
||||
/*global arangoHelper*/
|
||||
/*global arangoHelper, ace*/
|
||||
|
||||
|
||||
(function() {
|
||||
|
@ -11,6 +11,16 @@
|
|||
var view, div, div2, jQueryDummy;
|
||||
|
||||
beforeEach(function() {
|
||||
window.App = {
|
||||
notificationList: {
|
||||
add: function() {
|
||||
throw "Should be a spy";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
spyOn(window.App.notificationList, "add");
|
||||
|
||||
div = document.createElement("div");
|
||||
div.id = "content";
|
||||
document.body.appendChild(div);
|
||||
|
@ -20,19 +30,13 @@
|
|||
|
||||
window.modalView = new window.ModalView();
|
||||
|
||||
window.App = {
|
||||
notificationList: {
|
||||
add: function() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
spyOn(view, "getSystemQueries").andCallFake(function(){});
|
||||
spyOn(view, "getSystemQueries");
|
||||
|
||||
view.render();
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
delete window.App;
|
||||
document.body.removeChild(div);
|
||||
});
|
||||
|
||||
|
@ -290,7 +294,9 @@
|
|||
spyOn(localStorage, "setItem");
|
||||
|
||||
view.deleteAQL(e);
|
||||
expect(localStorage.setItem).toHaveBeenCalledWith("customQueries", JSON.stringify(view.customQueries));
|
||||
expect(localStorage.setItem).toHaveBeenCalledWith(
|
||||
"customQueries", JSON.stringify(view.customQueries)
|
||||
);
|
||||
expect(view.renderSelectboxes).toHaveBeenCalled();
|
||||
expect(view.updateTable).toHaveBeenCalled();
|
||||
});
|
||||
|
@ -301,7 +307,7 @@
|
|||
value: "for var yx do something"
|
||||
}], e = {
|
||||
target: "dontcare",
|
||||
stopPropagation: function() {}
|
||||
stopPropagation: function() {throw "Should be a spy";}
|
||||
};
|
||||
localStorage.setItem("customQueries", JSON.stringify(customQueries));
|
||||
view.initialize();
|
||||
|
@ -331,7 +337,9 @@
|
|||
value: "for var yx do something"
|
||||
}], e = {
|
||||
target: "dontcare",
|
||||
stopPropagation: function() {}
|
||||
stopPropagation: function() {
|
||||
throw "Should be a spy";
|
||||
}
|
||||
};
|
||||
localStorage.setItem("customQueries", JSON.stringify(customQueries));
|
||||
view.initialize();
|
||||
|
@ -361,7 +369,9 @@
|
|||
value: "for var yx do something"
|
||||
}], e = {
|
||||
target: "dontcare",
|
||||
stopPropagation: function() {}
|
||||
stopPropagation: function() {
|
||||
throw "Should be a spy";
|
||||
}
|
||||
};
|
||||
localStorage.setItem("customQueries", JSON.stringify(customQueries));
|
||||
view.initialize();
|
||||
|
@ -391,7 +401,9 @@
|
|||
value: "for var yx do something"
|
||||
}], e = {
|
||||
target: "dontcare",
|
||||
stopPropagation: function() {}
|
||||
stopPropagation: function() {
|
||||
throw "Should be a spy";
|
||||
}
|
||||
};
|
||||
localStorage.setItem("customQueries", JSON.stringify(customQueries));
|
||||
view.initialize();
|
||||
|
@ -419,11 +431,12 @@
|
|||
var customQueries = [{
|
||||
name: "hallotest",
|
||||
value: "for var yx do something"
|
||||
}];
|
||||
}],
|
||||
returnValue;
|
||||
localStorage.setItem("customQueries", JSON.stringify(customQueries));
|
||||
view.initialize();
|
||||
|
||||
var returnValue = view.getCustomQueryValueByName("hallotest");
|
||||
returnValue = view.getCustomQueryValueByName("hallotest");
|
||||
expect(returnValue).toEqual("for var yx do something");
|
||||
});
|
||||
|
||||
|
@ -432,14 +445,6 @@
|
|||
div2.id = "test123";
|
||||
document.body.appendChild(div2);
|
||||
|
||||
var customQueries = [{
|
||||
name: "hallotest",
|
||||
value: "for var yx do something"
|
||||
}], e = {
|
||||
currentTarget: {
|
||||
id: "test123"
|
||||
}
|
||||
};
|
||||
localStorage.setItem("querySize", 5000);
|
||||
|
||||
view.initialize();
|
||||
|
|
Loading…
Reference in New Issue