aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorFotoVerite <[email protected]>2013-06-12 01:31:21 -0400
committerFotoVerite <[email protected]>2013-06-12 01:31:21 -0400
commitd3d5ac2042851bd17fe29a7345ebb2f084c4b691 (patch)
tree0d441e086026afb798313134fe2d30f94abaf0e3 /test
parent97ef5dd3e60a9fcb1c44b471ab0ea0e4eb529dc2 (diff)
parentcce5d927e7e847c780e828972c92113d4cb7199f (diff)
downloadfaker-d3d5ac2042851bd17fe29a7345ebb2f084c4b691.tar.xz
faker-d3d5ac2042851bd17fe29a7345ebb2f084c4b691.zip
[util] merged in chrisocast changes, updated build and version.
Diffstat (limited to 'test')
-rw-r--r--test/lorem.unit.js18
1 files changed, 17 insertions, 1 deletions
diff --git a/test/lorem.unit.js b/test/lorem.unit.js
index de806ddd..d85cce91 100644
--- a/test/lorem.unit.js
+++ b/test/lorem.unit.js
@@ -35,7 +35,7 @@ describe("lorem.js", function () {
});
describe("sentence()", function () {
- context("when no 'wordCount' param passed in", function () {
+ context("when no 'wordCount' or 'range' param passed in", function () {
it("returns a string of at least three words", function () {
sinon.spy(Faker.Lorem, 'words');
sinon.stub(Faker.random, 'number').returns(2);
@@ -66,6 +66,22 @@ describe("lorem.js", function () {
Faker.random.number.restore();
});
});
+
+ context("when 'wordCount' and 'range' params passed in", function () {
+ it("returns a string of at least the requested number of words", function () {
+ sinon.spy(Faker.Lorem, 'words');
+ sinon.stub(Faker.random, 'number').returns(4);
+ var sentence = Faker.Lorem.sentence(10, 4);
+
+ assert.ok(typeof sentence === 'string');
+ var parts = sentence.split(' ');
+ assert.equal(parts.length, 14); // requested 10 plus stubbed 4.
+ assert.ok(Faker.Lorem.words.calledWith(14));
+
+ Faker.Lorem.words.restore();
+ Faker.random.number.restore();
+ });
+ });
});
describe("sentences()", function () {