aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJim Fitzpatrick <[email protected]>2016-05-05 11:24:22 -0400
committerMarak <[email protected]>2017-02-21 12:53:20 -0500
commit59ac9a632bb863e114fb05d241dce463f424c382 (patch)
treee31b4d791dfa2a907d0d9bf6b8a6998495bf0031 /test
parentef1605d1a94bae0bc38f0c8c0fc51f5fa4ba76f6 (diff)
downloadfaker-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.js17
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
+});