Skip to content

Commit

Permalink
test for long socket messges
Browse files Browse the repository at this point in the history
  • Loading branch information
evantahler committed Dec 2, 2012
1 parent 3737ba8 commit 6ca4ef9
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
5 changes: 3 additions & 2 deletions actions/cacheTest.js
Expand Up @@ -27,12 +27,13 @@ action.run = function(api, connection, next)

connection.response.cacheTestResults = {};

api.cache.save(api,key,value,null, function(err, resp){
api.cache.save(api, key, value, null, function(err, resp){
connection.response.cacheTestResults.saveResp = resp;
api.cache.size(api, function(err, numberOfCacheObjects){
connection.response.cacheTestResults.sizeResp = numberOfCacheObjects;
api.cache.load(api,key, function(err, resp, expireTimestamp, createdAt, readAt){
api.cache.load(api, key, function(err, resp, expireTimestamp, createdAt, readAt){
connection.response.cacheTestResults.loadResp = {
key: key,
value: resp,
expireTimestamp: expireTimestamp,
createdAt: createdAt,
Expand Down
6 changes: 3 additions & 3 deletions bin/include/generate.js
Expand Up @@ -72,9 +72,9 @@
},\r\n\
\"devDependencies\": {},\r\n\
\"scripts\": {\r\n\
\"start\": \"node ./node_modules/actionHero/bin/actionHero start\",\r\n\
\"startCluster\": \"node ./node_modules/actionHero/bin/actionHero startCluster\",\r\n\
\"help\": \"node ./node_modules/actionHero/bin/actionHero help\"\r\n\
\"start\": \"node ./node_modules/.bin/actionHero start\",\r\n\
\"startCluster\": \"node ./node_modules/.bin/actionHero startCluster\",\r\n\
\"help\": \"node ./node_modules/.bin/actionHero help\"\r\n\
}\r\n\
}\r\n\
";
Expand Down
1 change: 1 addition & 0 deletions initializers/initSocketServer.js
Expand Up @@ -185,6 +185,7 @@ var initSocketServer = function(api, next){
local_params["action"] = request_hash["action"];
}
}catch(e){
local_params = null;
connection.params["action"] = words[0];
}
connection.responsesWaitingCount++;
Expand Down
16 changes: 16 additions & 0 deletions test/client_socket.js
Expand Up @@ -78,6 +78,22 @@ describe('Client: Socket', function(){
});
});

it('really long messages are OK', function(done){
var msg = {
action: 'cacheTest',
params: {
key: apiObj.utils.randomString(16384),
value: apiObj.utils.randomString(16384),
},
}
makeSocketRequest(client, JSON.stringify(msg), function(response){
response.cacheTestResults.loadResp.key.should.eql("cacheTest_"+msg.params.key);
response.cacheTestResults.loadResp.value.should.eql(msg.params.value);
console.log(response)
done();
});
});

it('I can get my details', function(done){
makeSocketRequest(client2, "detailsView", function(response){
response.status.should.equal("OK")
Expand Down

0 comments on commit 6ca4ef9

Please sign in to comment.