Skip to content

Commit

Permalink
Fixes for typo's yup.. The best I can do is run spelling checks ;)
Browse files Browse the repository at this point in the history
  • Loading branch information
3rd-Eden committed Apr 15, 2011
1 parent 080dcb3 commit 67399b3
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 13 deletions.
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -2,7 +2,7 @@
"name": "memcached"
, "version": "0.0.1"
, "author": "Arnout Kazemier"
, "description": "A fully featured Memcached client, supporting both single and clustered Memcached server through consistent hashing and failover/ failure"
, "description": "A fully featured Memcached API client, supporting both single and clustered Memcached servers through consistent hashing and failover/failure"
, "main": "index"
, "keywords":[
"memcached"
Expand All @@ -15,6 +15,7 @@
, "cache"
, "nosql"
, "membase"
, "InnoDB memcached API"
]
, "directories": {
"lib": "./lib"
Expand Down
40 changes: 39 additions & 1 deletion tests/memcached-cas.test.js
Expand Up @@ -42,7 +42,7 @@ module.exports = {
}

/**
* Create a sucessful cas update
* Create a successful cas update, so we are sure we send a cas request correctly
*/
, "successful cas update" : function(){
var memcached = new Memcached(common.servers.single)
Expand All @@ -61,6 +61,7 @@ module.exports = {
message = common.alphabet(256);
memcached.cas("test:" + testnr, message, answer.cas, 1000, function(error, answer){
assert.ok(!error);
assert.ok(!!answer);

memcached.get("test:" + testnr, function(error, answer){

Expand All @@ -73,4 +74,41 @@ module.exports = {
});
});
}

/**
* Create a successful cas update, so we are sure we send a cas request correctly
*/
, "unsuccessful cas update" : function(){
var memcached = new Memcached(common.servers.single)
, message = common.alphabet(256)
, testnr = ++global.testnumbers;

memcached.set("test:" + testnr, message, 1000, function(error, ok){
assert.ok(!error);
ok.should.be.true;

memcached.gets("test:" + testnr, function(error, answer){
assert.ok(!error);
assert.ok(!!answer.cas);

// generate new message
message = common.alphabet(256);
memcached.set("test:" + testnr, message, 1000, function(){
memcached.cas("test:" + testnr, message, answer.cas, 1000, function(error, answer){
assert.ok(!error);
assert.ok(!answer);

memcached.get("test:" + testnr, function(error, answer){

assert.ok(!error);
answer.should.eql(message);

memcached.end(); // close connections
})
});
});
});
});
}

};
51 changes: 40 additions & 11 deletions tests/memcached-get-set.test.js
Expand Up @@ -19,8 +19,8 @@ module.exports = {

/**
* Make sure that the string that we send to the server is correctly
* stored and retreived. We will be storing random strings to ensure
* that we are not retreiving old data.
* stored and retrieved. We will be storing random strings to ensure
* that we are not retrieving old data.
*/
"set and get a regular string": function(){
var memcached = new Memcached(common.servers.single)
Expand Down Expand Up @@ -68,7 +68,7 @@ module.exports = {

/**
* Make sure that Numbers are correctly send and stored on the server
* retreival of the number based values can be tricky as the client might
* retrieval of the number based values can be tricky as the client might
* think that it was a INCR and not a SET operation.. So just to make sure..
*/
, "set and get a regular number": function(){
Expand All @@ -93,7 +93,7 @@ module.exports = {

/**
* Objects should be converted to a JSON string, send to the server
* and be automagically JSON.parsed when they are retreived.
* and be automagically JSON.parsed when they are retrieved.
*/
, "set and get a object": function(){
var memcached = new Memcached(common.servers.single)
Expand Down Expand Up @@ -121,7 +121,7 @@ module.exports = {

/**
* Arrays should be converted to a JSON string, send to the server
* and be automagically JSON.parsed when they are retreived.
* and be automagically JSON.parsed when they are retrieved.
*/
, "set and get a array": function(){
var memcached = new Memcached(common.servers.single)
Expand Down Expand Up @@ -156,10 +156,13 @@ module.exports = {
}

/**
* Bufers are commonly used for binary transports So we need to make sure
* we support them propperly
* Buffers are commonly used for binary transports So we need to make sure
* we support them properly. But please note, that we need to compare the
* strings on a "binary" level, because that is the encoding the Memcached
* client will be using, as there is no indication of what encoding the
* buffer is in.
*/
, "set and get buffers": function(){
, "set and get <buffers> with a binary image": function(){
var memcached = new Memcached(common.servers.single)
, message = fs.readFileSync(__dirname + '/fixtures/hotchicks.jpg')
, testnr = ++global.testnumbers;
Expand All @@ -177,7 +180,33 @@ module.exports = {
}

/**
* Not only small strings, but also large strings should be procesed
* Get binary of the lipsum.txt, send it over the connection and see
* if after we retrieved it, it's still the same when we compare the
* original with the memcached based version.
*
* A use case for this would be storing <buffers> with HTML data in
* memcached as a single cache pool..
*/
, "set and get <buffers> with a binary text file": function(){
var memcached = new Memcached(common.servers.single)
, message = fs.readFileSync(__dirname + '/fixtures/lipsum.txt')
, testnr = ++global.testnumbers;

memcached.set("test:" + testnr, message, 1000, function(error, ok){
assert.ok(!error);
ok.should.be.true;

memcached.get("test:" + testnr, function(error, answer){
assert.ok(!error);
assert.ok(answer.toString('utf8') === answer.toString('utf8'));
assert.ok(answer.toString('ascii') === answer.toString('ascii'));
memcached.end(); // close connections
});
});
}

/**
* Not only small strings, but also large strings should be processed
* without any issues.
*/
, "set and get large text files": function(){
Expand All @@ -202,7 +231,7 @@ module.exports = {
/**
* A multi get on a single server is different than a multi server multi get
* as a multi server multi get will need to do a multi get over multiple servers
* yes, that's allot of multi's in one single sentance thanks for noticing
* yes, that's allot of multi's in one single sentence thanks for noticing
*/
, "multi get single server": function(){
var memcached = new Memcached(common.servers.single)
Expand Down Expand Up @@ -233,7 +262,7 @@ module.exports = {
/**
* A multi get on a single server is different than a multi server multi get
* as a multi server multi get will need to do a multi get over multiple servers
* yes, that's allot of multi's in one single sentance thanks for noticing
* yes, that's allot of multi's in one single sentence thanks for noticing
*/
, "multi get multi server": function(){
var memcached = new Memcached(common.servers.multi)
Expand Down

0 comments on commit 67399b3

Please sign in to comment.