1
0
Fork 0

added test for #665

This commit is contained in:
Jan Steemann 2013-11-11 16:44:39 +01:00
parent a84fdacebf
commit dfe8d82f30
1 changed files with 60 additions and 0 deletions

View File

@ -235,6 +235,66 @@ function HashIndexSuite() {
catch (err) {
assertEqual(errors.ERROR_ARANGO_COLLECTION_NOT_FOUND.code, err.errorNum);
}
},
////////////////////////////////////////////////////////////////////////////////
/// @brief test: combination of indexes
////////////////////////////////////////////////////////////////////////////////
testMultiIndexViolation1 : function () {
collection.ensureUniqueConstraint("a");
collection.ensureSkiplist("b");
collection.save({ a : "test1", b : 1});
try {
collection.save({ a : "test1", b : 1});
fail();
}
catch (err1) {
}
var doc1 = collection.save({ a : "test2", b : 1});
assertTrue(doc1._key !== "");
try {
collection.save({ a : "test1", b : 1});
fail();
}
catch (err2) {
}
var doc2 = collection.save({ a : "test3", b : 1});
assertTrue(doc2._key !== "");
},
////////////////////////////////////////////////////////////////////////////////
/// @brief test: combination of indexes
////////////////////////////////////////////////////////////////////////////////
testMultiIndexViolation2 : function () {
collection.ensureUniqueSkiplist("a");
collection.ensureHashIndex("b");
collection.save({ a : "test1", b : 1});
try {
collection.save({ a : "test1", b : 1});
fail();
}
catch (err1) {
}
var doc1 = collection.save({ a : "test2", b : 1});
assertTrue(doc1._key !== "");
try {
collection.save({ a : "test1", b : 1});
fail();
}
catch (err2) {
}
var doc2 = collection.save({ a : "test3", b : 1});
assertTrue(doc2._key !== "");
}
};