diff options
| author | ChinCluBi <[email protected]> | 2016-09-27 03:27:59 +0700 |
|---|---|---|
| committer | ChinCluBi <[email protected]> | 2016-09-27 03:27:59 +0700 |
| commit | 267d8f41d0a104f4613a23165a2264e87dc9594b (patch) | |
| tree | c0d1cecffe167d1be55bccd7bb384dc1537fe479 | |
| parent | 87acfc6a5c072cbf00ab02d1cf673d4db7832946 (diff) | |
| download | faker-267d8f41d0a104f4613a23165a2264e87dc9594b.tar.xz faker-267d8f41d0a104f4613a23165a2264e87dc9594b.zip | |
remove object.assign.fix unit test
| -rw-r--r-- | lib/image.js | 3 | ||||
| -rw-r--r-- | test/image.unit.js | 24 |
2 files changed, 14 insertions, 13 deletions
diff --git a/lib/image.js b/lib/image.js index f64b1545..9ac21ce2 100644 --- a/lib/image.js +++ b/lib/image.js @@ -15,7 +15,8 @@ var Image = function (faker) { self.lorempixel = new Lorempixel(faker); self.unsplash = new Unsplash(faker); - Object.assign(self, self.unsplash); + // Object.assign(self, self.unsplash); + // How to set default as unsplash? should be image.default? } diff --git a/test/image.unit.js b/test/image.unit.js index d0d9a96e..95d18ab5 100644 --- a/test/image.unit.js +++ b/test/image.unit.js @@ -111,70 +111,70 @@ describe("image.js", function () { describe("unsplash", function() { describe("imageUrl()", function () { it("returns a random image url from unsplash", function () { - var imageUrl = faker.image.imageUrl(); + var imageUrl = faker.image.unsplash.imageUrl(); assert.equal(imageUrl, 'https://source.unsplash.com/640x480'); }); it("returns a random image url from unsplash with width and height", function () { - var imageUrl = faker.image.imageUrl(100, 100); + var imageUrl = faker.image.unsplash.imageUrl(100, 100); assert.equal(imageUrl, 'https://source.unsplash.com/100x100'); }); it("returns a random image url for a specified category", function () { - var imageUrl = faker.image.imageUrl(100, 100, 'food'); + var imageUrl = faker.image.unsplash.imageUrl(100, 100, 'food'); assert.equal(imageUrl, 'https://source.unsplash.com/category/food/100x100'); }); it("returns a random image url with correct keywords for a specified category", function () { - var imageUrl = faker.image.imageUrl(100, 100, 'food', 'keyword1,keyword2'); + var imageUrl = faker.image.unsplash.imageUrl(100, 100, 'food', 'keyword1,keyword2'); assert.equal(imageUrl, 'https://source.unsplash.com/category/food/100x100?keyword1,keyword2'); }); it("returns a random image url without keyword which format is wrong for a specified category", function () { - var imageUrl = faker.image.imageUrl(100, 100, 'food', 'keyword1,?ds)0123$*908932409'); + var imageUrl = faker.image.unsplash.imageUrl(100, 100, 'food', 'keyword1,?ds)0123$*908932409'); assert.equal(imageUrl, 'https://source.unsplash.com/category/food/100x100'); }); }); describe("image()", function() { it("returns a searching image url with keyword", function () { - var food = faker.image.image(100, 200, 'keyword1,keyword2,keyword3'); + var food = faker.image.unsplash.image(100, 200, 'keyword1,keyword2,keyword3'); assert.equal(food, 'https://source.unsplash.com/100x200?keyword1,keyword2,keyword3'); }); }) describe("food()", function () { it("returns a random food image url", function () { - var food = faker.image.food(); + var food = faker.image.unsplash.food(); assert.equal(food, 'https://source.unsplash.com/category/food/640x480'); }); }); describe("people()", function () { it("returns a random people image url", function () { - var people = faker.image.people(); + var people = faker.image.unsplash.people(); assert.equal(people, 'https://source.unsplash.com/category/people/640x480'); }); }); describe("nature()", function () { it("returns a random nature image url", function () { - var nature = faker.image.nature(); + var nature = faker.image.unsplash.nature(); assert.equal(nature, 'https://source.unsplash.com/category/nature/640x480'); }); }); describe("technology()", function () { it("returns a random technology image url", function () { - var transport = faker.image.technology(); + var transport = faker.image.unsplash.technology(); assert.equal(transport, 'https://source.unsplash.com/category/technology/640x480'); }); }); describe("objects()", function () { it("returns a random objects image url", function () { - var transport = faker.image.objects(); + var transport = faker.image.unsplash.objects(); assert.equal(transport, 'https://source.unsplash.com/category/objects/640x480'); }); }); describe("buildings()", function () { it("returns a random buildings image url", function () { - var transport = faker.image.buildings(); + var transport = faker.image.unsplash.buildings(); assert.equal(transport, 'https://source.unsplash.com/category/buildings/640x480'); }); }); |
