diff options
| author | Jim Fitzpatrick <[email protected]> | 2016-05-05 11:24:22 -0400 |
|---|---|---|
| committer | Marak <[email protected]> | 2017-02-21 12:53:20 -0500 |
| commit | 59ac9a632bb863e114fb05d241dce463f424c382 (patch) | |
| tree | e31b4d791dfa2a907d0d9bf6b8a6998495bf0031 /test | |
| parent | ef1605d1a94bae0bc38f0c8c0fc51f5fa4ba76f6 (diff) | |
| download | faker-59ac9a632bb863e114fb05d241dce463f424c382.tar.xz faker-59ac9a632bb863e114fb05d241dce463f424c382.zip | |
Statically bind all module methods
Statically bind the methods on all modules to their correct context so
that the methods can be called in a composable, callback-oriented
manner.
Closes #376
Conflicts:
lib/index.js
test/all.functional.js
Diffstat (limited to 'test')
| -rw-r--r-- | test/all.functional.js | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/test/all.functional.js b/test/all.functional.js index 4ea196b6..2fccb10a 100644 --- a/test/all.functional.js +++ b/test/all.functional.js @@ -31,18 +31,29 @@ var modules = { describe("functional tests", function () { + function assertMethodResult(meth, result) { + if (meth === 'boolean') { + assert.ok(result === true || result === false); + } else { + assert.ok(result); + } + } + for(var locale in faker.locales) { faker.locale = locale; Object.keys(modules).forEach(function (module) { describe(module, function () { modules[module].forEach(function (meth) { it(meth + "()", function () { - var result = faker[module][meth](); - assert.ok(result); + assertMethodResult(meth, faker[module][meth]()); + }); + + it(meth + "() without context", function () { + assertMethodResult(meth, faker[module][meth].call(null)); }); }); }); }); } -});
\ No newline at end of file +}); |
