|
@ -11,7 +11,7 @@ var testStore = function(args) { |
|
|
var self = {}; |
|
|
var self = {}; |
|
|
self.name = "options"; |
|
|
self.name = "options"; |
|
|
|
|
|
|
|
|
self.get = function(key, cb, options) { |
|
|
self.get = function(key, options, cb) { |
|
|
if (options && options.value) { |
|
|
if (options && options.value) { |
|
|
return cb(null, options.value + "ValueOption"); |
|
|
return cb(null, options.value + "ValueOption"); |
|
|
} else if (options && options.fn) { |
|
|
} else if (options && options.fn) { |
|
@ -21,7 +21,7 @@ var testStore = function(args) { |
|
|
return cb("Error No Options"); |
|
|
return cb("Error No Options"); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
self.set = function(key, value, ttl, cb, options) { |
|
|
self.set = function(key, value, options, cb) { |
|
|
if (options && options.value) { |
|
|
if (options && options.value) { |
|
|
memoryFlag = options.value + "ValueOption"; |
|
|
memoryFlag = options.value + "ValueOption"; |
|
|
return cb(); |
|
|
return cb(); |
|
@ -32,7 +32,7 @@ var testStore = function(args) { |
|
|
return cb("Error No Options"); |
|
|
return cb("Error No Options"); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
self.del = function(key, cb, options) { |
|
|
self.del = function(key, options, cb) { |
|
|
if (options && options.value) { |
|
|
if (options && options.value) { |
|
|
memoryFlag = options.value + "ValueOption"; |
|
|
memoryFlag = options.value + "ValueOption"; |
|
|
return cb(); |
|
|
return cb(); |
|
@ -64,10 +64,10 @@ describe("Methods with options", function() { |
|
|
|
|
|
|
|
|
it("lets us pass options by value", function(done) { |
|
|
it("lets us pass options by value", function(done) { |
|
|
var options = {value: value}; |
|
|
var options = {value: value}; |
|
|
testCache.get(key, function(err, response) { |
|
|
testCache.get(key, options, function(err, response) { |
|
|
assert.equal(response, value + "ValueOption"); |
|
|
assert.equal(response, value + "ValueOption"); |
|
|
done(); |
|
|
done(); |
|
|
}, options); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
it("lets us pass options by function", function(done) { |
|
|
it("lets us pass options by function", function(done) { |
|
@ -77,9 +77,9 @@ describe("Methods with options", function() { |
|
|
done(); |
|
|
done(); |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
testCache.get(key, function(err, response) { |
|
|
testCache.get(key , options, function(err, response) { |
|
|
assert.equal(response, "GetFunctionOption"); |
|
|
assert.equal(response, "GetFunctionOption"); |
|
|
}, options); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
describe("set with options", function() { |
|
|
describe("set with options", function() { |
|
@ -91,21 +91,22 @@ describe("Methods with options", function() { |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
it("lets us pass options by value", function(done) { |
|
|
it("lets us pass options by value", function(done) { |
|
|
var options = {value: value}; |
|
|
var options = {ttl: ttl, value: value}; |
|
|
testCache.set(key, value, ttl, function() { |
|
|
testCache.set(key, value, options, function() { |
|
|
assert.equal(memoryFlag, value + "ValueOption"); |
|
|
assert.equal(memoryFlag, value + "ValueOption"); |
|
|
done(); |
|
|
done(); |
|
|
}, options); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
it("lets us pass options by function", function(done) { |
|
|
it("lets us pass options by function", function(done) { |
|
|
var options = { |
|
|
var options = { |
|
|
|
|
|
ttl: ttl, |
|
|
fn: function(response) { |
|
|
fn: function(response) { |
|
|
assert.equal(response, "SetFunctionOption"); |
|
|
assert.equal(response, "SetFunctionOption"); |
|
|
done(); |
|
|
done(); |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
testCache.set(key, value, ttl, function() {}, options); |
|
|
testCache.set(key, value, options, function() {}, options); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
describe("delete with options", function() { |
|
|
describe("delete with options", function() { |
|
@ -117,10 +118,10 @@ describe("Methods with options", function() { |
|
|
|
|
|
|
|
|
it("lets us pass options by value", function(done) { |
|
|
it("lets us pass options by value", function(done) { |
|
|
var options = {value: value}; |
|
|
var options = {value: value}; |
|
|
testCache.del(key, function() { |
|
|
testCache.del(key, options, function() { |
|
|
assert.equal(memoryFlag,value + "ValueOption"); |
|
|
assert.equal(memoryFlag,value + "ValueOption"); |
|
|
done(); |
|
|
done(); |
|
|
}, options); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
it("lets us pass options by function", function(done) { |
|
|
it("lets us pass options by function", function(done) { |
|
@ -130,7 +131,7 @@ describe("Methods with options", function() { |
|
|
done(); |
|
|
done(); |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
testCache.del(key, function() {}, options); |
|
|
testCache.del(key, options, function() {}, options); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|