diff options
| author | Marak <[email protected]> | 2021-05-25 01:35:51 -0400 |
|---|---|---|
| committer | Marak <[email protected]> | 2021-05-25 01:35:51 -0400 |
| commit | f765f710b4a8715c66abc1404e5077a50722d318 (patch) | |
| tree | db93b23217fac0be50ab3678816d5912e8ce839d /test | |
| parent | b8d9bc9b904cb6a57db7f3c981f411a984e899cc (diff) | |
| parent | cb1cb46b6f4f4485816f78674ebcf0a6596bc67e (diff) | |
| download | faker-f765f710b4a8715c66abc1404e5077a50722d318.tar.xz faker-f765f710b4a8715c66abc1404e5077a50722d318.zip | |
Merge branch 'feature/word-types' of https://github.com/ad-walker/faker.js
Diffstat (limited to 'test')
| -rw-r--r-- | test/word.unit.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/word.unit.js b/test/word.unit.js new file mode 100644 index 00000000..692177ef --- /dev/null +++ b/test/word.unit.js @@ -0,0 +1,36 @@ +if (typeof module !== "undefined") { + var assert = require("assert"); + var faker = require("../index"); +} + +describe.only("word.js", function () { + var methods = [ + "adjective", + "adverb", + "conjunction", + "interjection", + "noun", + "preposition", + "verb", + ]; + // Perform the same three tests for each method. + methods.forEach(function (method) { + describe(method + "()", function () { + it("returns random value from " + method + " array", function () { + var word = faker.word[method](); + assert.ok(faker.definitions.word[method].includes(word)); + }); + it("optional length parameter returns expected result", function () { + var wordLength = 5; + var word = faker.word[method](wordLength); + assert.ok(faker.definitions.word[method].includes(word)); + assert.ok(word.length == wordLength); + }); + it("unresolvable optional length returns random " + method, function () { + var wordLength = 1000; + var word = faker.word[method](wordLength); + assert.ok(faker.definitions.word[method].includes(word)); + }); + }); + }); +}); |
