aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorKieu Anh Tuan <[email protected]>2014-01-07 17:03:03 +0100
committerKieu Anh Tuan <[email protected]>2014-01-07 17:11:31 +0100
commit41688effa91319121a7fe8a981c4a7ebb986339b (patch)
tree57296829cca4b3bef922858c50378094895ae251 /test
parent1bd1d73d29222c4e2f52d63a4282345b63a324df (diff)
downloadfaker-41688effa91319121a7fe8a981c4a7ebb986339b.tar.xz
faker-41688effa91319121a7fe8a981c4a7ebb986339b.zip
Add support to lorempixel image provider
Diffstat (limited to 'test')
-rw-r--r--test/image.unit.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/image.unit.js b/test/image.unit.js
new file mode 100644
index 00000000..005f15f7
--- /dev/null
+++ b/test/image.unit.js
@@ -0,0 +1,35 @@
+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.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.imageUrl(100, 100);
+
+ assert.equal(imageUrl, 'http://lorempixel.com/100/100');
+ });
+ it("returns a random image url in a abstract category", function () {
+ var imageUrl = Faker.Image.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.nightlife();
+ assert.equal(nightlife, 'http://lorempixel.com/640/480/nightlife');
+
+ var city = Faker.Image.city();
+ assert.equal(city, 'http://lorempixel.com/640/480/city');
+
+ var fashion = Faker.Image.fashion();
+ assert.equal(fashion, 'http://lorempixel.com/640/480/fashion');
+ });
+ });
+});