From 844069d1aa6945b78823c6ddba19b3f25bdcbc97 Mon Sep 17 00:00:00 2001 From: eugene Date: Sat, 12 Feb 2011 01:39:16 +1100 Subject: [PATCH] Initial Commit --- .gitignore | 2 ++ lib/expressobdd.js | 19 +++++++++++++++++++ package.json | 13 +++++++++++++ test/expressobdd.test.js | 26 ++++++++++++++++++++++++++ 4 files changed, 60 insertions(+) create mode 100644 .gitignore create mode 100644 lib/expressobdd.js create mode 100644 package.json create mode 100644 test/expressobdd.test.js diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bf9dfdc --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.swp +.DS_Store diff --git a/lib/expressobdd.js b/lib/expressobdd.js new file mode 100644 index 0000000..00906f0 --- /dev/null +++ b/lib/expressobdd.js @@ -0,0 +1,19 @@ +module.exports = function(tests) { + var results = {}; + + function parse(tests, prefix) { + for (var i in tests) { + if (tests[i] instanceof Function) { + results[(prefix.length ? ('[' + prefix.join('][') + ']: ') : '') + i] = tests[i]; + } else { + parse(tests[i], prefix.concat([i])); + } + } + } + + parse(tests, []); + + console.log(results); + + return results; +}; diff --git a/package.json b/package.json new file mode 100644 index 0000000..407b02b --- /dev/null +++ b/package.json @@ -0,0 +1,13 @@ +{ + "name" : "expressobdd", + "version" : "v1.0.0", + "description" : "Add basic multilevel describe/it bdd constructs to expresso", + "homepage" : "http://github.com/nharbour/expressobdd", + "keywords" : ["expresso", "expressobdd", "bdd", "test", "testing", "tests"], + "author" : "Eugene Ware ", + "maintainers" : ["Eugene Ware "], + "licenses" : ["MIT"], + "dependencies" : {"expresso": ">=0.7.2", "should": ">=0.0.4"}, + "main" : "./lib/expressobdd", + "repository" : { "type": "git", "url": "http://github.com/nharbour/expressobdd.git" } +} diff --git a/test/expressobdd.test.js b/test/expressobdd.test.js new file mode 100644 index 0000000..c25b4dd --- /dev/null +++ b/test/expressobdd.test.js @@ -0,0 +1,26 @@ +require('should'); + +module.exports = require('../lib/expressobdd')({ + 'group one': { + 'it should do x': function() { + var x = 2; + x.should.eql(2); + }, + + 'it should do y': function() { + var y = 3; + y.should.eql(3); + }, + + 'group one point 2': { + 'it should do w': function() { + var z = 5; + z.should.eql(6); + }, + }, + }, + 'it should do z': function() { + var z = 4; + z.should.eql(4); + }, +});