mirror of https://gitee.com/bigwinds/arangodb
Further refactoring, another suite now based on variables and prefixed with UnitTests
This commit is contained in:
parent
e345129987
commit
b1cdeca44c
|
@ -326,56 +326,51 @@ function GeneralGraphCreationSuite() {
|
||||||
},
|
},
|
||||||
|
|
||||||
test_get_graph_without_hit : function () {
|
test_get_graph_without_hit : function () {
|
||||||
var msg;
|
|
||||||
try {
|
try {
|
||||||
var a = graph._graph("bla4");
|
graph._graph(gn + "UnknownExtension");
|
||||||
|
fail();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
msg = e;
|
assertEqual(e, "graph " + gn + "UnknownExtension" + " does not exists.");
|
||||||
}
|
}
|
||||||
assertEqual(msg, "graph bla4 does not exists.");
|
|
||||||
},
|
},
|
||||||
|
|
||||||
test_creationOfGraphShouldNotAffectCollections: function() {
|
test_creationOfGraphShouldNotAffectCollections: function() {
|
||||||
var en = "UnitTestsEdges";
|
|
||||||
var vn1 = "UnitTestsVertices";
|
|
||||||
var vn2 = "UnitTestsVertices2";
|
|
||||||
var gn = "UnitTestsGraph";
|
|
||||||
if(graph._exists(gn)) {
|
if(graph._exists(gn)) {
|
||||||
graph._drop(gn);
|
graph._drop(gn);
|
||||||
}
|
}
|
||||||
var edgeDef = [graph._directedRelationDefinition(en, vn1, vn2)];
|
var edgeDef2 = [graph._directedRelationDefinition(rn, vn1, vn2)];
|
||||||
var g = graph._create(gn, edgeDef);
|
var g = graph._create(gn, edgeDef2);
|
||||||
var v1 = g[vn1].save({_key: "1"})._id;
|
var v1 = g[vn1].save({_key: "1"})._id;
|
||||||
var v2 = g[vn2].save({_key: "2"})._id;
|
var v2 = g[vn2].save({_key: "2"})._id;
|
||||||
var v3 = g[vn1].save({_key: "3"})._id;
|
var v3 = g[vn1].save({_key: "3"})._id;
|
||||||
|
|
||||||
g[en].save(v1, v2, {});
|
g[rn].save(v1, v2, {});
|
||||||
assertEqual(g[vn1].count(), 2);
|
assertEqual(g[vn1].count(), 2);
|
||||||
assertEqual(g[vn2].count(), 1);
|
assertEqual(g[vn2].count(), 1);
|
||||||
assertEqual(g[en].count(), 1);
|
assertEqual(g[rn].count(), 1);
|
||||||
try {
|
try {
|
||||||
g[en].save(v2, v3, {});
|
g[rn].save(v2, v3, {});
|
||||||
fail();
|
fail();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// This should create an error
|
// This should create an error
|
||||||
assertEqual(g[en].count(), 1);
|
assertEqual(g[rn].count(), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
db[en].save(v2, v3, {});
|
db[rn].save(v2, v3, {});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// This should not create an error
|
// This should not create an error
|
||||||
fail();
|
fail();
|
||||||
}
|
}
|
||||||
assertEqual(g[en].count(), 2);
|
assertEqual(g[rn].count(), 2);
|
||||||
|
|
||||||
db[vn2].remove(v2);
|
db[vn2].remove(v2);
|
||||||
// This should not remove edges
|
// This should not remove edges
|
||||||
assertEqual(g[en].count(), 2);
|
assertEqual(g[rn].count(), 2);
|
||||||
|
|
||||||
g[vn1].remove(v1);
|
g[vn1].remove(v1);
|
||||||
// This should remove edges
|
// This should remove edges
|
||||||
assertEqual(g[en].count(), 1);
|
assertEqual(g[rn].count(), 1);
|
||||||
graph._drop(gn, true);
|
graph._drop(gn, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue