forked from zuriby/Faker.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathall.functional.js
55 lines (51 loc) · 1.77 KB
/
all.functional.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
if (typeof module !== 'undefined') {
var assert = require('assert');
var sinon = require('sinon');
var faker = require('../index');
}
var functionalHelpers = require('./support/function-helpers.js');
var modules = functionalHelpers.modulesList();
describe("functional tests", function () {
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]();
if (meth === 'boolean') {
assert.ok(result === true || result === false);
} else {
assert.ok(result);
}
});
});
});
});
}
});
describe("faker.fake functional tests", function () {
for(var locale in faker.locales) {
faker.locale = locale;
faker.seed(1);
Object.keys(modules).forEach(function (module) {
describe(module, function () {
modules[module].forEach(function (meth) {
it(meth + "()", function () {
var result = faker.fake('{{' + module + '.' + meth + '}}');
// just make sure any result is returned
// an undefined result usually means an error
assert.ok(typeof result !== 'undefined');
/*
if (meth === 'boolean') {
assert.ok(result === true || result === false);
} else {
assert.ok(result);
}
*/
});
});
});
});
}
});