1
0
Fork 0

reformated tests

This commit is contained in:
scottashton 2014-03-31 14:31:39 +02:00
parent 75d123eea4
commit f7ceebe35b
2 changed files with 558 additions and 545 deletions

View File

@ -101,7 +101,6 @@
this.initVersionCheck();
var self = this;
$(window).resize(function () {
self.handleResize();
});
@ -117,19 +116,22 @@
async: true,
crossDomain: true,
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) {
if (typeof json !== 'object') {
return;
}
// 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
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;
mainLines.forEach(function (l) {
if (json[l].stable) {
@ -145,7 +147,8 @@
if (latestMainLine !== undefined &&
Object.keys(latestMainLine.versions).length > 0) {
mainLineVersions = Object.keys(latestMainLine.versions);
mainLineVersions = mainLineVersions.sort(window.versionHelper.compareVersionStrings);
mainLineVersions = mainLineVersions.
sort(window.versionHelper.compareVersionStrings);
latest = mainLineVersions[mainLineVersions.length - 1];
update = {
@ -163,7 +166,8 @@
Object.keys(json[mainLine].versions).length > 0) {
// sort by version numbers
mainLineVersions = Object.keys(json[mainLine].versions);
mainLineVersions = mainLineVersions.sort(window.versionHelper.compareVersionStrings);
mainLineVersions = mainLineVersions.
sort(window.versionHelper.compareVersionStrings);
latest = mainLineVersions[mainLineVersions.length - 1];
var result = window.versionHelper.compareVersions(
@ -370,7 +374,8 @@
graphManagement: function () {
if (!this.graphManagementView) {
this.graphManagementView = new window.GraphManagementView({collection: this.graphs});
this.graphManagementView =
new window.GraphManagementView({collection: this.graphs});
}
this.graphManagementView.render();
this.naviView.selectMenuItem('graphviewer-menu');
@ -411,7 +416,9 @@
this.foxxList.fetch({
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();
},

View File

@ -1,5 +1,5 @@
/*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, _*/
(function () {
@ -89,12 +89,12 @@
id: "statisticsDescription",
fetch: function () {
}
}
};
statisticsCollectionDummy = {
id: "statisticsCollection",
fetch: function () {
}
}
};
fakeDB = {
id: "fakeDB",
fetch: function () {
@ -150,14 +150,15 @@
spyOn(window, "DocumentsView").andReturn(documentsViewDummy);
spyOn(window, "DocumentView").andReturn(documentViewDummy);
;
spyOn(window, "arangoCollections").andReturn(storeDummy);
spyOn(window, "ArangoUsers").andReturn(sessionDummy);
spyOn(window, "arangoDocuments").andReturn(documentsDummy);
spyOn(window, "arangoDocument").andReturn(documentDummy);
spyOn(window, "GraphCollection").andReturn(graphsDummy);
spyOn(window, "FoxxCollection").andReturn(foxxDummy);
spyOn(window, "StatisticsDescriptionCollection").andReturn(statisticsDescriptionCollectionDummy);
spyOn(window, "StatisticsDescriptionCollection").andReturn(
statisticsDescriptionCollectionDummy
);
spyOn(window, "StatisticsCollection").andReturn(statisticsCollectionDummy);
spyOn(window, "CollectionsView").andReturn(collectionsViewDummy);
spyOn(window, "LogsView").andReturn(logsViewDummy);
@ -275,7 +276,9 @@
beforeEach(function () {
r = new window.Router();
simpleNavigationCheck = function (url, viewName, navTo, initObject, funcList, shouldNotRender, shouldNotCache) {
simpleNavigationCheck =
function (url, viewName, navTo, initObject,
funcList, shouldNotRender, shouldNotCache) {
var route,
view = {},
checkFuncExec = function () {
@ -419,8 +422,6 @@
return msg;
};
return true;
return leftDiff.length === 0
&& rightDiff.length === 0;
}
});
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) {
if (int === 5000) {
a();
@ -918,7 +920,8 @@
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) {
if (int === 5000) {
a();
@ -957,13 +960,15 @@
spyOn(arangoHelper, "arangoNotification");
r.initVersionCheck();
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 " +
"changelog at <a href=\"" + changes + "\">" +
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) {
if (int === 5000) {
a();
@ -996,7 +1001,8 @@
spyOn(arangoHelper, "arangoNotification");
r.initVersionCheck();
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 " +
"changelog at <a href=\"" + changes + "\">" +
changes + "</a>", 15000);