Further testing

This commit is contained in:
Jcar
2012-12-20 15:55:37 -08:00
parent 4a95549466
commit 099ffbddc0
5 changed files with 34 additions and 8 deletions

View File

@@ -40,10 +40,10 @@ buster.testCase("Fee Changes", {
*/ */
buster.testCase("Sending", { buster.testCase("Sending", {
'setUp' : testutils.build_setup(), 'setUp' : testutils.build_setup(), //
'tearDown' : testutils.build_teardown(), 'tearDown' : testutils.build_teardown(),
"send XRP to non-existent account with insufficent fee" : "send XRP to non-existent account with insufficent fee" : // => to run only that.
function (done) { function (done) {
var self = this; var self = this;
var ledgers = 20; var ledgers = 20;

View File

@@ -1,5 +1,5 @@
var buster = require("buster"); var buster = require("buster");
var testutils = require("./testutils.js");
var Server = require("./server.js").Server; var Server = require("./server.js").Server;
// How long to wait for server to start. // How long to wait for server to start.
@@ -8,6 +8,8 @@ var Server = require("./server.js").Server;
var alpha; var alpha;
buster.testCase("Standalone server startup", { buster.testCase("Standalone server startup", {
"server start and stop" : function (done) { "server start and stop" : function (done) {
alpha = Server.from_config("alpha",true); //ADD ,true for verbosity alpha = Server.from_config("alpha",true); //ADD ,true for verbosity

View File

@@ -31,7 +31,7 @@ var Server = function (name, config, verbose) {
this.config = config; this.config = config;
this.started = false; this.started = false;
this.quiet = !verbose; this.quiet = !verbose;
this.stopping = false; //Not sure if we need this... this.stopping = false;
}; };
Server.prototype = new EventEmitter; Server.prototype = new EventEmitter;
@@ -100,7 +100,7 @@ Server.prototype._serverSpawnSync = function() {
this.child.on('exit', function(code, signal) { this.child.on('exit', function(code, signal) {
// If could not exec: code=127, signal=null // If could not exec: code=127, signal=null
// If regular exit: code=0, signal=null // If regular exit: code=0, signal=null
buster.assert(!self.stopping); //Fail the test if the server is exiting without having called "stop" buster.assert(!self.stopping); //Fail the test if the server has called "stop"
if (!self.quiet) console.log("server: spawn: server exited code=%s: signal=%s", code, signal); if (!self.quiet) console.log("server: spawn: server exited code=%s: signal=%s", code, signal);
}); });
}; };
@@ -150,7 +150,7 @@ Server.prototype.start = function () {
// Stop a standalone server. // Stop a standalone server.
Server.prototype.stop = function () { Server.prototype.stop = function () {
var self = this; var self = this;
self.stopping = true; //Tell the caller that the server is properly stopping. self.stopping = true;
if (this.child) { if (this.child) {
// Update the on exit to invoke done. // Update the on exit to invoke done.
this.child.on('exit', function (code, signal) { this.child.on('exit', function (code, signal) {

View File

@@ -6,6 +6,9 @@ var Remote = require("../src/js/remote.js").Remote;
var Server = require("./server.js").Server; var Server = require("./server.js").Server;
var child = require("child_process"); //Testing spawn
var testutils = require("./testutils.js"); var testutils = require("./testutils.js");
buster.spec.expose(); buster.spec.expose();
@@ -14,8 +17,27 @@ describe("My thing", function () {
it("states the obvious", function () { it("states the obvious", function () {
expect(true).toBe(true);; expect(true).toBe(true);;
}); });
//var spawn = child.spawn,
ls = child.spawn('ls', ['-lh', '/']);
ls.stdout.on('data', function (data) {
console.log('stdout: ' + data);
});
ls.stderr.on('data', function (data) {
console.log('stderr: ' + data);
});
ls.on('exit', function (code) {
console.log('child process exited with code ' + code);
});
}); });
/*
buster.testCase("Basic Path finding", { buster.testCase("Basic Path finding", {
'setUp' : testutils.build_setup(), 'setUp' : testutils.build_setup(),
'tearDown' : testutils.build_teardown(), 'tearDown' : testutils.build_teardown(),
@@ -64,3 +86,5 @@ buster.testCase("Basic Path finding", {
}, },
}); });
*/