Skip to content

Commit

Permalink
Adds unit test for lorem.word()
Browse files Browse the repository at this point in the history
  • Loading branch information
jreina committed Jul 28, 2017
1 parent 6cdb93e commit c2031a9
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/lorem.unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,24 @@ if (typeof module !== 'undefined') {
}

describe("lorem.js", function () {
describe("word()", function () {
beforeEach(function () {
sinon.spy(faker.helpers, 'shuffle');
});

afterEach(function () {
faker.helpers.shuffle.restore();
});

context("when 'num' param passed in", function () {
it("returns a word with the requested length", function () {
var str = faker.lorem.word(5);
assert.ok(typeof str === 'string');
assert.equal(str.length, 5);
});
});
});

describe("words()", function () {
beforeEach(function () {
sinon.spy(faker.helpers, 'shuffle');
Expand Down

0 comments on commit c2031a9

Please sign in to comment.