mirror of https://gitee.com/bigwinds/arangodb
Added tests for cluster views, of necessary information is passed through each view
This commit is contained in:
parent
8d48855875
commit
d78e3ed92b
|
@ -1,5 +1,5 @@
|
||||||
/*jslint indent: 2, nomen: true, maxlen: 100, white: true, plusplus: true */
|
/*jslint indent: 2, nomen: true, maxlen: 100, white: true, plusplus: true */
|
||||||
/*global window, Backbone */
|
/*global window, Backbone, console */
|
||||||
(function() {
|
(function() {
|
||||||
"use strict";
|
"use strict";
|
||||||
window.ClusterCoordinators = Backbone.Collection.extend({
|
window.ClusterCoordinators = Backbone.Collection.extend({
|
||||||
|
|
|
@ -223,12 +223,21 @@ module.exports = function(karma) {
|
||||||
// 'test/specs/graphViewer/specNodeReducer/modularityJoinerSpec.js',
|
// 'test/specs/graphViewer/specNodeReducer/modularityJoinerSpec.js',
|
||||||
// 'test/specs/graphViewer/specWindowObjects/workerWrapperSpec.js',
|
// 'test/specs/graphViewer/specWindowObjects/workerWrapperSpec.js',
|
||||||
'test/specs/graphViewer/specContextMenu/contextMenuSpec.js',
|
'test/specs/graphViewer/specContextMenu/contextMenuSpec.js',
|
||||||
|
|
||||||
// Arango
|
// Arango
|
||||||
'test/specs/arango/arangoSpec.js',
|
'test/specs/arango/arangoSpec.js',
|
||||||
|
|
||||||
// Models
|
// Models
|
||||||
'test/specs/models/currentDatabaseSpec.js',
|
'test/specs/models/currentDatabaseSpec.js',
|
||||||
'test/specs/models/graphSpec.js',
|
'test/specs/models/graphSpec.js',
|
||||||
|
|
||||||
|
// Collections
|
||||||
|
'test/specs/collections/clusterServersSpec.js',
|
||||||
|
'test/specs/collections/clusterDatabasesSpec.js',
|
||||||
|
'test/specs/collections/clusterCollectionsSpec.js',
|
||||||
|
'test/specs/collections/clusterShardsSpec.js',
|
||||||
|
|
||||||
|
|
||||||
// Views
|
// Views
|
||||||
'test/specs/views/editListEntryViewSpec.js',
|
'test/specs/views/editListEntryViewSpec.js',
|
||||||
'test/specs/views/collectionViewSpec.js',
|
'test/specs/views/collectionViewSpec.js',
|
||||||
|
|
|
@ -6,9 +6,11 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
describe("Cluster Collection View", function() {
|
describe("Cluster Collection View", function() {
|
||||||
var view, div, shardsView, shardCol;
|
var view, div, shardsView, shardCol, server, db;
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
|
server = "pavel";
|
||||||
|
db = "_system";
|
||||||
div = document.createElement("div");
|
div = document.createElement("div");
|
||||||
div.id = "clusterCollections";
|
div.id = "clusterCollections";
|
||||||
document.body.appendChild(div);
|
document.body.appendChild(div);
|
||||||
|
@ -81,7 +83,7 @@
|
||||||
view = new window.ClusterCollectionView({
|
view = new window.ClusterCollectionView({
|
||||||
collection: collCol
|
collection: collCol
|
||||||
});
|
});
|
||||||
view.render();
|
view.render(db, server);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should not unrender the server view", function() {
|
it("should not unrender the server view", function() {
|
||||||
|
@ -117,27 +119,18 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should be able to navigate to Documents", function() {
|
it("should be able to navigate to Documents", function() {
|
||||||
info = {
|
|
||||||
name: "Documents"
|
|
||||||
};
|
|
||||||
$("#Documents").click();
|
$("#Documents").click();
|
||||||
expect(shardsView.render).toHaveBeenCalledWith(info);
|
expect(shardsView.render).toHaveBeenCalledWith(db, "Documents", server);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should be able to navigate to Edges", function() {
|
it("should be able to navigate to Edges", function() {
|
||||||
info = {
|
|
||||||
name: "Edges"
|
|
||||||
};
|
|
||||||
$("#Edges").click();
|
$("#Edges").click();
|
||||||
expect(shardsView.render).toHaveBeenCalledWith(info);
|
expect(shardsView.render).toHaveBeenCalledWith(db, "Edges", server);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should be able to navigate to People", function() {
|
it("should be able to navigate to People", function() {
|
||||||
info = {
|
|
||||||
name: "People"
|
|
||||||
};
|
|
||||||
$("#People").click();
|
$("#People").click();
|
||||||
expect(shardsView.render).toHaveBeenCalledWith(info);
|
expect(shardsView.render).toHaveBeenCalledWith(db, "People", server);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -6,9 +6,10 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
describe("Cluster Database View", function() {
|
describe("Cluster Database View", function() {
|
||||||
var view, div, colView, colCol;
|
var view, div, colView, colCol, server;
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
|
server = "pavel";
|
||||||
div = document.createElement("div");
|
div = document.createElement("div");
|
||||||
div.id = "clusterDatabases";
|
div.id = "clusterDatabases";
|
||||||
document.body.appendChild(div);
|
document.body.appendChild(div);
|
||||||
|
@ -83,7 +84,7 @@
|
||||||
view = new window.ClusterDatabaseView({
|
view = new window.ClusterDatabaseView({
|
||||||
collection: dbCol
|
collection: dbCol
|
||||||
});
|
});
|
||||||
view.render();
|
view.render(server);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should not render the Server view", function() {
|
it("should not render the Server view", function() {
|
||||||
|
@ -116,19 +117,19 @@
|
||||||
it("should be able to navigate to _system", function() {
|
it("should be able to navigate to _system", function() {
|
||||||
db = "_system";
|
db = "_system";
|
||||||
$("#" + db).click();
|
$("#" + db).click();
|
||||||
expect(colView.render).toHaveBeenCalledWith(db);
|
expect(colView.render).toHaveBeenCalledWith(db, server);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should be able to navigate to myDatabase", function() {
|
it("should be able to navigate to myDatabase", function() {
|
||||||
db = "myDatabase";
|
db = "myDatabase";
|
||||||
$("#" + db).click();
|
$("#" + db).click();
|
||||||
expect(colView.render).toHaveBeenCalledWith(db);
|
expect(colView.render).toHaveBeenCalledWith(db, server);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should be able to navigate to otherDatabase", function() {
|
it("should be able to navigate to otherDatabase", function() {
|
||||||
db = "otherDatabase";
|
db = "otherDatabase";
|
||||||
$("#" + db).click();
|
$("#" + db).click();
|
||||||
expect(colView.render).toHaveBeenCalledWith(db);
|
expect(colView.render).toHaveBeenCalledWith(db, server);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -57,11 +57,8 @@
|
||||||
dbView.render.reset();
|
dbView.render.reset();
|
||||||
view.render.reset();
|
view.render.reset();
|
||||||
var name = o.primary.name;
|
var name = o.primary.name;
|
||||||
info = {
|
|
||||||
name: name
|
|
||||||
};
|
|
||||||
$(getTile(name)).click();
|
$(getTile(name)).click();
|
||||||
expect(dbView.render).toHaveBeenCalledWith(info);
|
expect(dbView.render).toHaveBeenCalledWith(name);
|
||||||
expect(view.render).toHaveBeenCalledWith(true);
|
expect(view.render).toHaveBeenCalledWith(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -22,27 +22,27 @@
|
||||||
describe("rendering", function() {
|
describe("rendering", function() {
|
||||||
|
|
||||||
var s1, s2, s3, shards, shardCol,
|
var s1, s2, s3, shards, shardCol,
|
||||||
checkButtonContent = function(col, cls) {
|
checkButtonContent = function(sh, cls) {
|
||||||
var btn = document.getElementById(col.name);
|
var btn = document.getElementById(sh.id);
|
||||||
expect(btn).toBeOfClass("btn");
|
expect(btn).toBeOfClass("btn");
|
||||||
expect(btn).toBeOfClass("btn-server");
|
expect(btn).toBeOfClass("btn-server");
|
||||||
expect(btn).toBeOfClass("shard");
|
expect(btn).toBeOfClass("shard");
|
||||||
expect(btn).toBeOfClass("btn-" + cls);
|
expect(btn).toBeOfClass("btn-" + cls);
|
||||||
expect($(btn).text()).toEqual(col.name);
|
expect($(btn).text()).toEqual(sh.id);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
s1 = {
|
s1 = {
|
||||||
name: "Shard 1",
|
id: "Shard 1",
|
||||||
status: "ok"
|
status: "ok"
|
||||||
};
|
};
|
||||||
s2 = {
|
s2 = {
|
||||||
name: "Shard 2",
|
id: "Shard 2",
|
||||||
status: "warning"
|
status: "warning"
|
||||||
};
|
};
|
||||||
s3 = {
|
s3 = {
|
||||||
name: "Shard 3",
|
id: "Shard 3",
|
||||||
status: "critical"
|
status: "critical"
|
||||||
};
|
};
|
||||||
shards = [
|
shards = [
|
||||||
|
|
Loading…
Reference in New Issue