aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan Donovan <[email protected]>2013-01-06 18:41:37 -0800
committerBryan Donovan <[email protected]>2013-01-06 18:41:37 -0800
commit0bdf6cb4bcef86c8d563ec1657f59b13a3da8560 (patch)
treef9b90df47e3f77deaaf7b65095978bacb31c8f2d
parent71884c826400558d62e0b131b236b84c93f2889d (diff)
downloadfaker-0bdf6cb4bcef86c8d563ec1657f59b13a3da8560.tar.xz
faker-0bdf6cb4bcef86c8d563ec1657f59b13a3da8560.zip
adding functional test for each function
-rw-r--r--test/all.functional.js46
1 files changed, 46 insertions, 0 deletions
diff --git a/test/all.functional.js b/test/all.functional.js
new file mode 100644
index 00000000..49fdea73
--- /dev/null
+++ b/test/all.functional.js
@@ -0,0 +1,46 @@
+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',
+ 'brState', 'ukCountry', 'ukCounty', 'usState', 'zipCode'//, 'zipCodeFormat'
+ ],
+
+ Company: ['companyName', 'companySuffix', 'catchPhrase', 'bs'],
+
+ Internet: ['email', 'userName', 'domainName', 'domainWord', 'ip'],
+
+ Lorem: ['words', 'sentence', 'sentences', 'paragraph', 'paragraphs'],
+
+ Name: ['firstName', 'lastName', 'findName'],
+
+ PhoneNumber: ['phoneNumber']
+};
+
+describe("functional tests", function () {
+ 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);
+ });
+ });
+ });
+ });
+
+ describe("Address", function() {
+ it("zipCodeFormat()", function() {
+ var result = Faker.Address.zipCodeFormat(0);
+ assert.ok(!result.match(/-/));
+
+ result = Faker.Address.zipCodeFormat(1);
+ assert.ok(result.match(/-/));
+ });
+ });
+});