aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorcyanos3 <[email protected]>2013-11-05 17:44:10 -0700
committercyanos3 <[email protected]>2013-11-05 17:44:10 -0700
commit5aa4062dcabc2fdac1c93df09e71d702ec7ec81e (patch)
tree5022d64e6be92badc9282e7c40c0817ecacd3c95 /test
parent229f9b9d04bab0d57d575b71f2f8a281e53a58ec (diff)
downloadfaker-5aa4062dcabc2fdac1c93df09e71d702ec7ec81e.tar.xz
faker-5aa4062dcabc2fdac1c93df09e71d702ec7ec81e.zip
Tree: let the width parameter also be a function that returns an int
Diffstat (limited to 'test')
-rw-r--r--test/tree.unit.js18
1 files changed, 16 insertions, 2 deletions
diff --git a/test/tree.unit.js b/test/tree.unit.js
index dc6c9530..3af144eb 100644
--- a/test/tree.unit.js
+++ b/test/tree.unit.js
@@ -91,6 +91,20 @@ describe("tree.js", function () {
Faker.random.first_name.restore();
});
- });
+ it("can accept a function for the width", function () {
+ var widthFuncCalled = 0;
+ var widthFunc = function () {
+ widthFuncCalled = widthFuncCalled + 1;
+ return 2;
+ };
+
+ var tree = Faker.Tree.createTree(2, widthFunc, proto);
+ assert.equal(widthFuncCalled, 3);
+
+ Faker.random.first_name.restore();
-});
+ });
+
+
+ });
+}); \ No newline at end of file