Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added test to DBCollectionTest.js

  • Loading branch information...
commit aab47db5b65a27d2c53fb2af00c6493b2aade0b9 1 parent c821c6e
@sergi authored
Showing with 25 additions and 1 deletion.
  1. +25 −1 tests/DBCollectionTest.js
View
26 tests/DBCollectionTest.js
@@ -17,7 +17,7 @@ exports.testCreateCollection = function() {
obj = c.findOne(123);
- print(typeof(obj));
+ //for (var i in obj.toMap()) print(i);
assert.isEqual(123, obj["_id"], "2");
assert.isEqual(2, obj["x"], "3");
assert.isEqual(2, obj["z"], "4");
@@ -36,5 +36,29 @@ exports.testCreateCollection = function() {
assert.isEqual(2, obj["y"], "11");
}
+exports.testDropIndex = function() {
+ var c = _db.getCollection( "dropindex1" );
+ c.drop();
+
+ c.save( {"x": 1 });
+ assert.isEqual( 1 , c.getIndexInfo().size() );
+
+ c.ensureIndex( {"x": 1} );
+ assert.isEqual( 2 , c.getIndexInfo().size() );
+
+ c.dropIndexes();
+ assert.isEqual( 1 , c.getIndexInfo().size() );
+
+ c.ensureIndex( {"x": 1} );
+ assert.isEqual( 2 , c.getIndexInfo().size() );
+
+ c.ensureIndex( {"y": 1} );
+ assert.isEqual( 3 , c.getIndexInfo().size() );
+
+ c.dropIndex( {"x": 1} );
+ assert.isEqual( 2 , c.getIndexInfo().size() );
+
+}
+
if (require.main === module.id)
require("os").exit(require("test/runner").run(exports));

0 comments on commit aab47db

Please sign in to comment.
Something went wrong with that request. Please try again.