aboutsummaryrefslogtreecommitdiff
path: root/test/image.unit.js
diff options
context:
space:
mode:
authorMatthew Bergman <[email protected]>2014-02-17 21:05:35 -0500
committerMatthew Bergman <[email protected]>2014-02-17 21:05:35 -0500
commit7710092ab44ce820dc73799193badee4e5ebce0c (patch)
treef5a369600fe0c1f7e675d1eff58ba38ff39da07a /test/image.unit.js
parent934945d9ca59f197b9e8971d8d428ad9dd86d419 (diff)
parent47527ec7391b15f915b25e983da80e98360ed04a (diff)
downloadfaker-7710092ab44ce820dc73799193badee4e5ebce0c.tar.xz
faker-7710092ab44ce820dc73799193badee4e5ebce0c.zip
Merge pull request #1 from Marak/master
Merging Upstream into master branch
Diffstat (limited to 'test/image.unit.js')
-rw-r--r--test/image.unit.js38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/image.unit.js b/test/image.unit.js
new file mode 100644
index 00000000..046291ad
--- /dev/null
+++ b/test/image.unit.js
@@ -0,0 +1,38 @@
+if (typeof module !== 'undefined') {
+ var assert = require('assert');
+ var sinon = require('sinon');
+ var Faker = require('../index');
+}
+
+describe("image.js", function () {
+ describe("imageUrl()", function () {
+ it("returns a random image url from lorempixel", function () {
+ var imageUrl = Faker.Image.LoremPixel.imageUrl();
+
+ assert.equal(imageUrl, 'http://lorempixel.com/640/480');
+ });
+ it("returns a random image url from lorempixel with width and height", function () {
+ var imageUrl = Faker.Image.LoremPixel.imageUrl(100, 100);
+
+ assert.equal(imageUrl, 'http://lorempixel.com/100/100');
+ });
+ it("returns a random image url in an abstract category", function () {
+ var imageUrl = Faker.Image.LoremPixel.imageUrl(100, 100, 'abstract');
+
+ assert.equal(imageUrl, 'http://lorempixel.com/100/100/abstract');
+ });
+ it("returns a random image url in a category via proxy methods", function () {
+ var nightlife = Faker.Image.LoremPixel.nightlife();
+ assert.equal(nightlife, 'http://lorempixel.com/640/480/nightlife');
+
+ var city = Faker.Image.LoremPixel.city();
+ assert.equal(city, 'http://lorempixel.com/640/480/city');
+
+ var fashion = Faker.Image.LoremPixel.fashion();
+ assert.equal(fashion, 'http://lorempixel.com/640/480/fashion');
+ });
+ it("return a random avatar from UIFaces", function () {
+ assert.notEqual(-1, Faker.Image.UIFaces.avatar().indexOf('s3.amazonaws.com/uifaces/faces'));
+ })
+ });
+});