Permalink
Browse files

turn the examples into tests

  • Loading branch information...
substack committed Jul 12, 2012
1 parent b7610ea commit 60040fe44f5b33dec54cde0e37cedc809a5b9375
Showing with 22 additions and 0 deletions.
  1. +1 −0 test/config.json
  2. +1 −0 test/foo/bar/baz/config.json
  3. +1 −0 test/foo/bar/config.json
  4. +1 −0 test/foo/config.json
  5. +18 −0 test/w.js
View
@@ -0,0 +1 @@
+{ "W" : 777, "q" : { "w" : 7 }, "n" : 3 }
@@ -0,0 +1 @@
+{ "X" : 444, "q" : { "x" : 4 }, "n" : 0 }
View
@@ -0,0 +1 @@
+{ "Y" : 555, "q" : { "y" : 5 }, "n" : 1 }
View
@@ -0,0 +1 @@
+{ "Z" : 666, "q" : { "z" : 6 }, "n" : 2 }
View
@@ -0,0 +1,18 @@
+var test = require('tap').test;
+var confuse = require('../');
+
+test('lots of configs', function (t) {
+ t.same(confuse({ dir : __dirname }), {
+ W: 777, q: { w: 7 }, n: 3
+ });
+ t.same(confuse({ dir : __dirname + '/foo' }), {
+ W: 777, q: { w: 7, z: 6 }, n: 2, Z: 666
+ });
+ t.same(confuse({ dir : __dirname + '/foo/bar' }), {
+ W: 777, q: { w: 7, z: 6, y: 5 }, n: 1, Z: 666, Y: 555
+ });
+ t.same(confuse({ dir : __dirname + '/foo/bar/baz' }), {
+ W: 777, q: { w: 7, z: 6, y: 5, x: 4 }, n: 0, Z: 666, Y: 555, X: 444
+ });
+ t.end();
+});

0 comments on commit 60040fe

Please sign in to comment.