mirror of https://gitee.com/bigwinds/arangodb
reformated tests
This commit is contained in:
parent
75d123eea4
commit
f7ceebe35b
|
@ -101,7 +101,6 @@
|
||||||
|
|
||||||
this.initVersionCheck();
|
this.initVersionCheck();
|
||||||
|
|
||||||
var self = this;
|
|
||||||
$(window).resize(function () {
|
$(window).resize(function () {
|
||||||
self.handleResize();
|
self.handleResize();
|
||||||
});
|
});
|
||||||
|
@ -117,19 +116,22 @@
|
||||||
async: true,
|
async: true,
|
||||||
crossDomain: true,
|
crossDomain: true,
|
||||||
dataType: "jsonp",
|
dataType: "jsonp",
|
||||||
url: "https://www.arangodb.org/repositories/versions.php?callback=parseVersions",
|
url: "https://www.arangodb.org/repositories/versions.php" +
|
||||||
|
"?callback=parseVersions",
|
||||||
success: function (json) {
|
success: function (json) {
|
||||||
if (typeof json !== 'object') {
|
if (typeof json !== 'object') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// turn our own version string into a version object
|
// turn our own version string into a version object
|
||||||
var currentVersion = window.versionHelper.fromString(self.footerView.system.version);
|
var currentVersion =
|
||||||
|
window.versionHelper.fromString(self.footerView.system.version);
|
||||||
|
|
||||||
// get our mainline version
|
// get our mainline version
|
||||||
var mainLine = window.versionHelper.toStringMainLine(currentVersion);
|
var mainLine = window.versionHelper.toStringMainLine(currentVersion);
|
||||||
|
|
||||||
var mainLines = Object.keys(json).sort(window.versionHelper.compareVersionStrings);
|
var mainLines = Object.keys(json).
|
||||||
|
sort(window.versionHelper.compareVersionStrings);
|
||||||
var latestMainLine;
|
var latestMainLine;
|
||||||
mainLines.forEach(function (l) {
|
mainLines.forEach(function (l) {
|
||||||
if (json[l].stable) {
|
if (json[l].stable) {
|
||||||
|
@ -145,7 +147,8 @@
|
||||||
if (latestMainLine !== undefined &&
|
if (latestMainLine !== undefined &&
|
||||||
Object.keys(latestMainLine.versions).length > 0) {
|
Object.keys(latestMainLine.versions).length > 0) {
|
||||||
mainLineVersions = Object.keys(latestMainLine.versions);
|
mainLineVersions = Object.keys(latestMainLine.versions);
|
||||||
mainLineVersions = mainLineVersions.sort(window.versionHelper.compareVersionStrings);
|
mainLineVersions = mainLineVersions.
|
||||||
|
sort(window.versionHelper.compareVersionStrings);
|
||||||
latest = mainLineVersions[mainLineVersions.length - 1];
|
latest = mainLineVersions[mainLineVersions.length - 1];
|
||||||
|
|
||||||
update = {
|
update = {
|
||||||
|
@ -163,7 +166,8 @@
|
||||||
Object.keys(json[mainLine].versions).length > 0) {
|
Object.keys(json[mainLine].versions).length > 0) {
|
||||||
// sort by version numbers
|
// sort by version numbers
|
||||||
mainLineVersions = Object.keys(json[mainLine].versions);
|
mainLineVersions = Object.keys(json[mainLine].versions);
|
||||||
mainLineVersions = mainLineVersions.sort(window.versionHelper.compareVersionStrings);
|
mainLineVersions = mainLineVersions.
|
||||||
|
sort(window.versionHelper.compareVersionStrings);
|
||||||
latest = mainLineVersions[mainLineVersions.length - 1];
|
latest = mainLineVersions[mainLineVersions.length - 1];
|
||||||
|
|
||||||
var result = window.versionHelper.compareVersions(
|
var result = window.versionHelper.compareVersions(
|
||||||
|
@ -370,7 +374,8 @@
|
||||||
|
|
||||||
graphManagement: function () {
|
graphManagement: function () {
|
||||||
if (!this.graphManagementView) {
|
if (!this.graphManagementView) {
|
||||||
this.graphManagementView = new window.GraphManagementView({collection: this.graphs});
|
this.graphManagementView =
|
||||||
|
new window.GraphManagementView({collection: this.graphs});
|
||||||
}
|
}
|
||||||
this.graphManagementView.render();
|
this.graphManagementView.render();
|
||||||
this.naviView.selectMenuItem('graphviewer-menu');
|
this.naviView.selectMenuItem('graphviewer-menu');
|
||||||
|
@ -411,7 +416,9 @@
|
||||||
this.foxxList.fetch({
|
this.foxxList.fetch({
|
||||||
async: false
|
async: false
|
||||||
});
|
});
|
||||||
var editAppView = new window.foxxEditView({model: this.foxxList.findWhere({_key: appkey})});
|
var editAppView = new window.foxxEditView(
|
||||||
|
{model: this.foxxList.findWhere({_key: appkey})}
|
||||||
|
);
|
||||||
editAppView.render();
|
editAppView.render();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -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, it, spyOn, expect*/
|
/*global describe, beforeEach, arangoHelper, afterEach, it, console, spyOn, expect*/
|
||||||
/*global $, jasmine, _*/
|
/*global $, jasmine, _*/
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
|
@ -89,12 +89,12 @@
|
||||||
id: "statisticsDescription",
|
id: "statisticsDescription",
|
||||||
fetch: function () {
|
fetch: function () {
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
statisticsCollectionDummy = {
|
statisticsCollectionDummy = {
|
||||||
id: "statisticsCollection",
|
id: "statisticsCollection",
|
||||||
fetch: function () {
|
fetch: function () {
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
fakeDB = {
|
fakeDB = {
|
||||||
id: "fakeDB",
|
id: "fakeDB",
|
||||||
fetch: function () {
|
fetch: function () {
|
||||||
|
@ -150,14 +150,15 @@
|
||||||
|
|
||||||
spyOn(window, "DocumentsView").andReturn(documentsViewDummy);
|
spyOn(window, "DocumentsView").andReturn(documentsViewDummy);
|
||||||
spyOn(window, "DocumentView").andReturn(documentViewDummy);
|
spyOn(window, "DocumentView").andReturn(documentViewDummy);
|
||||||
;
|
|
||||||
spyOn(window, "arangoCollections").andReturn(storeDummy);
|
spyOn(window, "arangoCollections").andReturn(storeDummy);
|
||||||
spyOn(window, "ArangoUsers").andReturn(sessionDummy);
|
spyOn(window, "ArangoUsers").andReturn(sessionDummy);
|
||||||
spyOn(window, "arangoDocuments").andReturn(documentsDummy);
|
spyOn(window, "arangoDocuments").andReturn(documentsDummy);
|
||||||
spyOn(window, "arangoDocument").andReturn(documentDummy);
|
spyOn(window, "arangoDocument").andReturn(documentDummy);
|
||||||
spyOn(window, "GraphCollection").andReturn(graphsDummy);
|
spyOn(window, "GraphCollection").andReturn(graphsDummy);
|
||||||
spyOn(window, "FoxxCollection").andReturn(foxxDummy);
|
spyOn(window, "FoxxCollection").andReturn(foxxDummy);
|
||||||
spyOn(window, "StatisticsDescriptionCollection").andReturn(statisticsDescriptionCollectionDummy);
|
spyOn(window, "StatisticsDescriptionCollection").andReturn(
|
||||||
|
statisticsDescriptionCollectionDummy
|
||||||
|
);
|
||||||
spyOn(window, "StatisticsCollection").andReturn(statisticsCollectionDummy);
|
spyOn(window, "StatisticsCollection").andReturn(statisticsCollectionDummy);
|
||||||
spyOn(window, "CollectionsView").andReturn(collectionsViewDummy);
|
spyOn(window, "CollectionsView").andReturn(collectionsViewDummy);
|
||||||
spyOn(window, "LogsView").andReturn(logsViewDummy);
|
spyOn(window, "LogsView").andReturn(logsViewDummy);
|
||||||
|
@ -275,7 +276,9 @@
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
r = new window.Router();
|
r = new window.Router();
|
||||||
simpleNavigationCheck = function (url, viewName, navTo, initObject, funcList, shouldNotRender, shouldNotCache) {
|
simpleNavigationCheck =
|
||||||
|
function (url, viewName, navTo, initObject,
|
||||||
|
funcList, shouldNotRender, shouldNotCache) {
|
||||||
var route,
|
var route,
|
||||||
view = {},
|
view = {},
|
||||||
checkFuncExec = function () {
|
checkFuncExec = function () {
|
||||||
|
@ -419,8 +422,6 @@
|
||||||
return msg;
|
return msg;
|
||||||
};
|
};
|
||||||
return true;
|
return true;
|
||||||
return leftDiff.length === 0
|
|
||||||
&& rightDiff.length === 0;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
expect(available).toDefineTheRoutes(expected);
|
expect(available).toDefineTheRoutes(expected);
|
||||||
|
@ -881,7 +882,8 @@
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("initVersionCheck with installed Version 2.0.1, latest 2.0.1, stablee 2.0.1", function () {
|
it("initVersionCheck with installed Version 2.0.1, latest 2.0.1, stablee 2.0.1",
|
||||||
|
function () {
|
||||||
spyOn(window, "setTimeout").andCallFake(function (a, int) {
|
spyOn(window, "setTimeout").andCallFake(function (a, int) {
|
||||||
if (int === 5000) {
|
if (int === 5000) {
|
||||||
a();
|
a();
|
||||||
|
@ -918,7 +920,8 @@
|
||||||
expect(arangoHelper.arangoNotification).not.toHaveBeenCalled();
|
expect(arangoHelper.arangoNotification).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("initVersionCheck with installed Version 1.4.5, latest 2.0.1, stable 2.0.1", function () {
|
it("initVersionCheck with installed Version 1.4.5, " +
|
||||||
|
"latest 2.0.1, stable 2.0.1", function () {
|
||||||
spyOn(window, "setTimeout").andCallFake(function (a, int) {
|
spyOn(window, "setTimeout").andCallFake(function (a, int) {
|
||||||
if (int === 5000) {
|
if (int === 5000) {
|
||||||
a();
|
a();
|
||||||
|
@ -957,13 +960,15 @@
|
||||||
spyOn(arangoHelper, "arangoNotification");
|
spyOn(arangoHelper, "arangoNotification");
|
||||||
r.initVersionCheck();
|
r.initVersionCheck();
|
||||||
var changes = "https:\/\/www.arangodb.org\/2.0.1";
|
var changes = "https:\/\/www.arangodb.org\/2.0.1";
|
||||||
expect(arangoHelper.arangoNotification).toHaveBeenCalledWith("A newer version of ArangoDB (2.0.1" +
|
expect(arangoHelper.arangoNotification).toHaveBeenCalledWith(
|
||||||
|
"A newer version of ArangoDB (2.0.1" +
|
||||||
") has become available. You may want to check the " +
|
") has become available. You may want to check the " +
|
||||||
"changelog at <a href=\"" + changes + "\">" +
|
"changelog at <a href=\"" + changes + "\">" +
|
||||||
changes + "</a>", 15000);
|
changes + "</a>", 15000);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("initVersionCheck with installed Version 2.0.0, latest 2.0.2, stable 2.0.1", function () {
|
it("initVersionCheck with installed Version 2.0.0, latest 2.0.2, stable 2.0.1",
|
||||||
|
function () {
|
||||||
spyOn(window, "setTimeout").andCallFake(function (a, int) {
|
spyOn(window, "setTimeout").andCallFake(function (a, int) {
|
||||||
if (int === 5000) {
|
if (int === 5000) {
|
||||||
a();
|
a();
|
||||||
|
@ -996,7 +1001,8 @@
|
||||||
spyOn(arangoHelper, "arangoNotification");
|
spyOn(arangoHelper, "arangoNotification");
|
||||||
r.initVersionCheck();
|
r.initVersionCheck();
|
||||||
var changes = "https:\/\/www.arangodb.org\/2.1.1";
|
var changes = "https:\/\/www.arangodb.org\/2.1.1";
|
||||||
expect(arangoHelper.arangoNotification).toHaveBeenCalledWith("A newer version of ArangoDB (2.1.1" +
|
expect(arangoHelper.arangoNotification).toHaveBeenCalledWith(
|
||||||
|
"A newer version of ArangoDB (2.1.1" +
|
||||||
") has become available. You may want to check the " +
|
") has become available. You may want to check the " +
|
||||||
"changelog at <a href=\"" + changes + "\">" +
|
"changelog at <a href=\"" + changes + "\">" +
|
||||||
changes + "</a>", 15000);
|
changes + "</a>", 15000);
|
||||||
|
|
Loading…
Reference in New Issue