From 862af2664a372f97fb7aaa68aac0f02601d4603d Mon Sep 17 00:00:00 2001 From: xdenser Date: Fri, 17 Dec 2010 00:56:44 +0200 Subject: [PATCH] added nodeunit and 1 test --- .gitmodules | 3 +++ package.json | 15 ++++++++++++++- tests/config.js | 14 ++++++++++++++ tests/def/test-binding.js | 19 +++++++++++++++++++ tools/nodeunit | 1 + wscript | 10 +++++++++- 6 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 .gitmodules create mode 100644 tests/config.js create mode 100644 tests/def/test-binding.js create mode 160000 tools/nodeunit diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..7edaabc --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "tools/nodeunit"] + path = tools/nodeunit + url = git://github.com/caolan/nodeunit.git diff --git a/package.json b/package.json index 1642d41..3234d85 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,20 @@ { "name" : "firebird" , "version" : "0.0.1" , "description" : "very basic libfbclient binding to node" -, "author": "Denys Khanzhiyev aka XDenSer" +, "author": "Denys Khanzhiyev" , "main": "./firebird" , "scripts": { "install": "node-waf configure build" } +, "maintainers" : + [ { "name": "Denys Khanzhiyev" + , "email": "xdenser@gmail.com" + } + ] +, "bugs" : { "web" : "http://github.com/xdenser/node-firebird-libfbclient/issues" } +, "licenses" : [ { "type" : "MIT" } ] +, "repositories" : + [ { "type" : "git" + , "url" : "http://github.com/xdenser/node-firebird-libfbclient.git" + } + ] + } diff --git a/tests/config.js b/tests/config.js new file mode 100644 index 0000000..3f8325b --- /dev/null +++ b/tests/config.js @@ -0,0 +1,14 @@ +/* +Copyright by Denys Khanzhiyev + +See license text in LICENSE file +*/ + +exports.cfg = { + // Database connection settings + db: "test.fdb", + user: "sysdba", + password: "masterkey", + role: "" +}; + diff --git a/tests/def/test-binding.js b/tests/def/test-binding.js new file mode 100644 index 0000000..243ddde --- /dev/null +++ b/tests/def/test-binding.js @@ -0,0 +1,19 @@ +/* +Copyright by Denys Khanzhiyev +See license text in LICENSE file +*/ + +// Load configuration +var cfg = require("../config").cfg; + +// Require modules +var + fb_binding = require("../../build/default/binding"); + +exports.Connect = function (test) { + test.expect(1); + var conn = new fb_binding.Connection; + test.ok(conn, "Connection inited"); + test.done(); +}; + diff --git a/tools/nodeunit b/tools/nodeunit new file mode 160000 index 0000000..8a31df2 --- /dev/null +++ b/tools/nodeunit @@ -0,0 +1 @@ +Subproject commit 8a31df2da23f57942a305ed9e2b92bf0db19d5f7 diff --git a/wscript b/wscript index 164a062..475a3c4 100644 --- a/wscript +++ b/wscript @@ -1,4 +1,4 @@ -import Options +import Options, Utils from os import unlink, symlink, popen from os.path import exists @@ -26,3 +26,11 @@ def build(bld): obj.source = "binding.cc" obj.uselib = "FB" +def test(tst): + node_binary = 'node' + + if not exists('./tools/nodeunit/bin/nodeunit'): + print("\033[31mNodeunit doesn't exists.\033[39m\nYou should run `git submodule update --init` before run tests.") + exit(1) + else: + Utils.exec_command(node_binary + ' ./tools/nodeunit/bin/nodeunit tests/def') \ No newline at end of file