diff options
| author | Bryan Donovan <[email protected]> | 2013-01-05 18:14:28 -0800 |
|---|---|---|
| committer | Bryan Donovan <[email protected]> | 2013-01-05 18:14:28 -0800 |
| commit | 72a36253b1d4f42a0630b6dfcff47e5d98c8ff2a (patch) | |
| tree | 698ca1356b0c7cc5c0b33a890876aae5a36c1a61 /test | |
| parent | 306c77c9971bdf6dc6c23fef7aeb9964323cd95f (diff) | |
| download | faker-72a36253b1d4f42a0630b6dfcff47e5d98c8ff2a.tar.xz faker-72a36253b1d4f42a0630b6dfcff47e5d98c8ff2a.zip | |
renaming tests dir to test
Diffstat (limited to 'test')
| -rw-r--r-- | test/browser_test.html | 40 | ||||
| -rw-r--r-- | test/library_test.js | 9 | ||||
| -rw-r--r-- | test/node_min_test.js | 10 | ||||
| -rwxr-xr-x | test/run.js | 3 |
4 files changed, 62 insertions, 0 deletions
diff --git a/test/browser_test.html b/test/browser_test.html new file mode 100644 index 00000000..91511cdf --- /dev/null +++ b/test/browser_test.html @@ -0,0 +1,40 @@ +<html> + <head> + <script src = "../Faker.js" type = "text/javascript"></script> + <script> + var card = Faker.Helpers.createCard(); + if(typeof JSON == 'undefined'){ + document.write('get a real browser that has JSON.stringify and JSON.parse built in <br/>'); + // implement JSON.stringify serialization + var JSON = {}; + JSON.stringify = function (obj) { + var t = typeof (obj); + if (t != "object" || obj === null) { + // simple data type + if (t == "string") obj = '"'+obj+'"'; + return String(obj); + } + else { + // recurse array or object + var n, v, json = [], arr = (obj && obj.constructor == Array); + for (n in obj) { + v = obj[n]; t = typeof(v); + if (t == "string") v = '"'+v+'"'; + else if (t == "object" && v !== null) v = JSON.stringify(v); + json.push((arr ? "" : '"' + n + '":') + String(v)); + } + return (arr ? "[" : "{") + String(json) + (arr ? "]" : "}"); + } + }; + } + document.write(JSON.stringify(card)); + </script> + </head> + <body> + </body> +</html> + + + + + diff --git a/test/library_test.js b/test/library_test.js new file mode 100644 index 00000000..6ca84286 --- /dev/null +++ b/test/library_test.js @@ -0,0 +1,9 @@ +var util = require('util'); + +var definitions = require('../lib/definitions'); + +var Faker = require('../index'); + +var card = Faker.Helpers.createCard(); + +util.puts(JSON.stringify(card)); diff --git a/test/node_min_test.js b/test/node_min_test.js new file mode 100644 index 00000000..6fc051a5 --- /dev/null +++ b/test/node_min_test.js @@ -0,0 +1,10 @@ +var util = require('util'); + +var Faker = require('../Faker'); + +var card = Faker.Helpers.createCard(); + +util.puts(JSON.stringify(card)); + + + diff --git a/test/run.js b/test/run.js new file mode 100755 index 00000000..5a2586a4 --- /dev/null +++ b/test/run.js @@ -0,0 +1,3 @@ +#!/usr/bin/env node +require('./library_test'); +require('./node_min_test'); |
