From 5a49b696ad1ae6395d04f8300fc37a5fe4bba554 Mon Sep 17 00:00:00 2001 From: Arthur Britto Date: Tue, 25 Sep 2012 19:37:15 -0700 Subject: [PATCH] UT: Get WS ledger_current test working. --- test/standalone-test.js | 81 ++++++++++++++++++++++------------------- 1 file changed, 44 insertions(+), 37 deletions(-) diff --git a/test/standalone-test.js b/test/standalone-test.js index b36929eb44..2a725dffac 100644 --- a/test/standalone-test.js +++ b/test/standalone-test.js @@ -12,7 +12,6 @@ var serverDelay = 1500; buster.testRunner.timeout = 5000; - buster.testCase("Standalone server startup", { "server start and stop": function(done) { server.start("alpha", @@ -56,44 +55,52 @@ buster.testCase("WebSocket connection", { buster.assert(3 == stat); // CLOSED done(); }); - }, undefined, serverDelay); + }, serverDelay); }, }); -// var alpha = remote.remoteConfig("alpha"); -// -// buster.testCase("Websocket commands", { -// 'setUp' : -// function(done) { -// server.start("alpha", -// function(e) { -// buster.refute(e); -// -// alpha.connect(function(stat) { -// buster.assert(1 == stat); // OPEN -// -// done(); -// }); -// }); -// }, -// -// 'tearDown' : -// function(done) { -// alpha.disconnect(function(stat) { -// buster.assert(3 == stat); // CLOSED -// -// server.stop("alpha", function(e) { -// buster.refute(e); -// -// done(); -// }); -// }); -// }, -// -// "assert" : -// function() { -// buster.assert(true); -// } -// }); +// XXX Figure out a way to stuff this into the test case. +var alpha; + +buster.testCase("Websocket commands", { + 'setUp' : + function(done) { + server.start("alpha", + function(e) { + buster.refute(e); + + alpha = remote.remoteConfig(config, "alpha"); + + alpha.connect(function(stat) { + buster.assert(1 == stat); // OPEN + + done(); + }, serverDelay); + }); + }, + + 'tearDown' : + function(done) { + alpha.disconnect(function(stat) { + buster.assert(3 == stat); // CLOSED + + server.stop("alpha", function(e) { + buster.refute(e); + + done(); + }); + }); + }, + + "ledger_current" : + function(done) { + alpha.ledger_current(function (r) { + console.log(r); + + buster.assert(r.ledger === 2); + done(); + }); + } +}); // vim:ts=4