forked from zuriby/Faker.js
-
Notifications
You must be signed in to change notification settings - Fork 1
/
all.functional.js
46 lines (34 loc) · 1.35 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
if (typeof module !== 'undefined') {
var assert = require('assert');
var sinon = require('sinon');
var faker = require('../index');
}
// Basic smoke tests to make sure each method is at least implemented and returns a string.
var modules = {
address: [
'city', 'streetName', 'streetAddress', 'secondaryAddress',
'country', 'county', 'state', 'zipCode'
],
company: ['companyName', 'companySuffix', 'catchPhrase', 'bs'],
internet: ['email', 'userName', 'domainName', 'domainWord', 'ip'],
lorem: ['words', 'sentence', 'sentences', 'paragraph', 'paragraphs'],
name: ['firstName', 'lastName', 'findName', 'jobTitle'],
phone: ['phoneNumber'],
finance: ['account', 'accountName', 'mask', 'amount', 'transactionType', 'currencyCode', 'currencyName', 'currencySymbol']
// commerce: ['color', 'department', 'productName', 'price']
};
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]();
assert.ok(result);
});
});
});
});
}
});