From 04f0b12a13529a7b2251a876cb3e0c371e41e86f Mon Sep 17 00:00:00 2001 From: Arthur Britto Date: Tue, 25 Sep 2012 15:14:27 -0700 Subject: [PATCH] UT: Initial tests of creating and connecting to a standalone store. --- test/config.js | 14 ++++++++------ test/standalone-test.js | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 6 deletions(-) diff --git a/test/config.js b/test/config.js index 6b320f248f..0610373db9 100644 --- a/test/config.js +++ b/test/config.js @@ -9,15 +9,17 @@ exports.newcoind = path.join(process.cwd(), "newcoind"); // Configuration for servers. exports.servers = { + // A local test server. alpha : { + 'trusted' : true, // "peer_ip" : "0.0.0.0", // "peer_port" : 51235, - "rpc_ip" : "0.0.0.0", - "rpc_port" : 5005, - "websocket_ip" : "127.0.0.1", - "websocket_port" : 6005, - "validation_seed" : "shhDFVsmS2GSu5vUyZSPXYfj1r79h", - "validators" : "n9L8LZZCwsdXzKUN9zoVxs4YznYXZ9hEhsQZY7aVpxtFaSceiyDZ beta" + 'rpc_ip' : "0.0.0.0", + 'rpc_port' : 5005, + 'websocket_ip' : "127.0.0.1", + 'websocket_port' : 6005, + 'validation_seed' : "shhDFVsmS2GSu5vUyZSPXYfj1r79h", + 'validators' : "n9L8LZZCwsdXzKUN9zoVxs4YznYXZ9hEhsQZY7aVpxtFaSceiyDZ beta" } }; // vim:ts=4 diff --git a/test/standalone-test.js b/test/standalone-test.js index d707baeca3..c50e50154a 100644 --- a/test/standalone-test.js +++ b/test/standalone-test.js @@ -4,6 +4,7 @@ var fs = require("fs"); var buster = require("buster"); var server = require("./server.js"); +var remote = require("../js/remote.js"); buster.testCase("Check standalone server startup", { "server start and stop": function(done) { @@ -18,4 +19,44 @@ buster.testCase("Check standalone server startup", { } }); +buster.testCase("Check websocket connection", { + 'setUp' : + function(done) { + server.start("alpha", + function(e) { + buster.refute(e); + done(); + }); + }, + + 'tearDown' : + function(done) { + server.stop("alpha", function(e) { + buster.refute(e); + done(); + }); + }, + + "websocket connect and disconnect" : + function(done) { + var alpha = remote.remoteConfig("alpha"); + + alpha.connect(function(stat) { + buster.assert(1 == stat); // OPEN + + alpha.disconnect(function(stat) { + buster.assert(3 == stat); // CLOSED + done(); + }); + }); + }, +}); + +buster.testCase("Check assert", { + "assert" : + function() { + buster.assert(true); + } +}); + // vim:ts=4