Skip to content

Commit

Permalink
tested.
Browse files Browse the repository at this point in the history
  • Loading branch information
yathit committed May 6, 2016
1 parent 23699f6 commit 7267bbf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/ydn/db/crud/req/indexed_db.js
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ ydn.db.crud.req.IndexedDb.prototype.removeByKeys = function(req, keys) {
removeAt(i);
};
} else {
req.setDbValue(0);
removeAt(i);
}
};
request.onerror = function(event) {
Expand Down
17 changes: 12 additions & 5 deletions test/crud/crud_14_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ var test_remove_by_key_range = function() {
};


var test_clear_by_key_range = function() {
function test_clear_by_key_range() {
//ydn.db.con.simple.Store.DEBUG = true;
var db_name = 'test_43_clear_by_key_range';
var schema = {
Expand Down Expand Up @@ -187,7 +187,7 @@ var test_clear_by_key_range = function() {



var test_remove_by_key = function() {
function test_remove_by_key() {
var db_name = 'test_remove_by_key';
var schema = {
stores: [{
Expand All @@ -205,7 +205,7 @@ var test_remove_by_key = function() {
}

var done = false;
var delCount, keys_before, keys_after;
var delCount, keys_before, keys_after, countInvalid, countInvalidValid;

waitForCondition(
// Condition
Expand All @@ -214,7 +214,9 @@ var test_remove_by_key = function() {
function() {
assertEquals('3 keys before', 3, keys_before.length);
assertEquals('delete count', 1, delCount);
assertEquals('2 keys after', 2, keys_after.length);
assertEquals('delete count invalid', 0, countInvalid);
assertEquals('delete count countInvalidValid', 1, countInvalidValid);
assertEquals('1 keys after', 1, keys_after.length);
reachedFinalContinuation = true;
ydn.db.deleteDatabase(db_name, db.getType());
db.close();
Expand All @@ -234,14 +236,19 @@ var test_remove_by_key = function() {
db.remove(new ydn.db.Key('st', ids[1])).addBoth(function(x) {
delCount = x;
});
db.remove(new ydn.db.Key('st', 10)).addBoth(function(x) {
countInvalid = x;
});
db.remove([new ydn.db.Key('st', 11), new ydn.db.Key('st', ids[0])]).addBoth(function(x) {
countInvalidValid = x;
});
db.keys('st').addBoth(function(x) {
keys_after = x;
done = true;
});
};



var tearDownPage = function() {

};
Expand Down

0 comments on commit 7267bbf

Please sign in to comment.