1
0
Fork 0

Merge pull request #375 from triAGENS/graph-drop

Graph.drop should check if vertices are used more than once
This commit is contained in:
Lucas Dohmen 2013-10-31 09:07:49 -07:00
commit d6efc0f052
2 changed files with 19 additions and 1 deletions

View File

@ -68,6 +68,21 @@ function GraphCreationSuite() {
graph.drop();
},
testDroppingIfVertexCollectionIsUsedTwice : function () {
var Graph = require("org/arangodb/graph").Graph,
graph_name = "UnitTestsCollectionGraph",
other_graph_name = "UnitTestsCollectionOtherGraph",
vertex = "UnitTestsCollectionVertex",
edges = "UnitTestsCollectionEdge",
other_edges = "UnitTestsCollectionOtherEdges",
graph = new Graph(graph_name, vertex, edges),
other_graph = new Graph(other_graph_name, vertex, other_edges);
graph.drop();
assertTrue(arangodb.db._collection("UnitTestsCollectionVertex") !== null);
other_graph.drop();
},
////////////////////////////////////////////////////////////////////////////////
/// @brief test: Find Graph
////////////////////////////////////////////////////////////////////////////////

View File

@ -555,7 +555,10 @@ Graph.prototype.drop = function (waitForSync) {
gdb.remove(this._properties, true, waitForSync);
this._vertices.drop();
if (gdb.byExample({vertices: this._vertices.name()}).count() === 0) {
this._vertices.drop();
}
this._edges.drop();
};