Created
May 5, 2012 16:42
-
-
Save bingomanatee/2603908 to your computer and use it in GitHub Desktop.
getting strange error
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var NE = require('./../lib'); | |
var path = require('path'); | |
var _ = require('underscore'); | |
var util = require('util'); | |
var request = require('request'); | |
var fs = require('fs'); | |
var path = require('path'); | |
var framework; | |
var app_path = path.resolve(__dirname + '/../test_resources/Server_Action_test/app'); | |
var root = 'http://localhost:3333/'; | |
module.exports = { | |
setUp:function (cb) { | |
framework = new NE.Framework({path:app_path}); | |
framework.start_load(function () { | |
console.log('load done'); | |
framework.start_server(function () { | |
console.log('server started'); | |
// console.log('framework: %s', util.inspect(framework)); | |
framework.server().listen(framework.config.port); | |
cb(); | |
}) | |
}, app_path); | |
}, | |
test_config:function (t) { | |
request.get(root + 'config/config', function (err, re, body) { | |
if (err){ | |
console.log(err); | |
} else { | |
var configs = {"qaay":10, "bar":6, "vole":-1}; | |
try { | |
var parsed = JSON.parse(body); | |
// test.deepEqual(parsed, configs, 'testing config'); | |
} catch (err) { | |
console.log('bad', body, 'cannot parse body'); | |
} | |
} | |
t.done(); | |
}); | |
}, | |
test_config2:function (test) { | |
request.get(root + 'config/config2', function (er, re, body) { | |
var configs = { dum:[ 4, 3, 1, 2 ] }; | |
try { | |
var body_configs = JSON.parse(body); | |
configs.dum = _.sortBy(configs.dum, _.identity); | |
body_configs.dum = _.sortBy(body_configs.dum, _.identity); | |
test.deepEqual(body_configs, configs, 'testing config'); | |
} catch (err) { | |
console.log('bad', body, 'cannot parse body'); | |
} | |
// test.done(); | |
}); | |
}, | |
tearDown:function (cb) { | |
framework.server().close(); | |
cb(); | |
} | |
} | |
server() is an express.js server.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
in3962:nuby-express dedelhart$ sudo nodeunit new_tests/
Get_Config_test
PATH HANDLER >>COMPONENT<< Controller --- read /Users/dedelhart/OS/test_express_3/node_modules/nuby-express/test_resources/Server_Action_test/app/controller_config into FRAMEWORK app (/Users/dedelhart/OS/test_express_3/node_modules/nuby-express/test_resources/Server_Action_test/app)
PATH HANDLER >>COMPONENT<< Controller --- read /Users/dedelhart/OS/test_express_3/node_modules/nuby-express/test_resources/Server_Action_test/app/controller_foo into FRAMEWORK app (/Users/dedelhart/OS/test_express_3/node_modules/nuby-express/test_resources/Server_Action_test/app)
PATH HANDLER >>COMPONENT<< Controller --- read /Users/dedelhart/OS/test_express_3/node_modules/nuby-express/test_resources/Server_Action_test/app/controller_home into FRAMEWORK app (/Users/dedelhart/OS/test_express_3/node_modules/nuby-express/test_resources/Server_Action_test/app)
load done
server started
server started
timers.js:96
if (!process.listeners('uncaughtException').length) throw e;
^
TypeError: Cannot read property 'value' of undefined
at /usr/local/lib/node_modules/nodeunit/deps/async.js:158:23
at /usr/local/lib/node_modules/nodeunit/deps/async.js:118:13
at /usr/local/lib/node_modules/nodeunit/deps/async.js:129:25
at /usr/local/lib/node_modules/nodeunit/deps/async.js:160:17
at /usr/local/lib/node_modules/nodeunit/deps/async.js:458:34
at /Users/dedelhart/OS/test_express_3/node_modules/nuby-express/new_tests/Get_Config_test.js:25:17
at Res.start_server (/Users/dedelhart/OS/test_express_3/node_modules/nuby-express/test_resources/Server_Action_test/app/resources/express_helper/express_view.js:11:9)
at /Users/dedelhart/OS/test_express_3/node_modules/nuby-express/lib/Framework/start_server.js:20:13
at Array.forEach (native)
at Framework.start_server (/Users/dedelhart/OS/test_express_3/node_modules/nuby-express/lib/Framework/start_server.js:19:8)
in3962:nuby-express dedelhart$