diff options
| author | Marak <[email protected]> | 2021-03-22 16:31:25 -0400 |
|---|---|---|
| committer | Marak <[email protected]> | 2021-03-22 16:31:25 -0400 |
| commit | 10dd7e30cf49f03c34da1ab540df2172be40c8ea (patch) | |
| tree | a2ebc6179065775a9466a2148eb05a00fe6d23f7 /test/fake.unit.js | |
| parent | 0b75623dac94f6062ae623fa8bbfe0e81b205d4d (diff) | |
| download | faker-10dd7e30cf49f03c34da1ab540df2172be40c8ea.tar.xz faker-10dd7e30cf49f03c34da1ab540df2172be40c8ea.zip | |
Linting fixes for `./test`
Diffstat (limited to 'test/fake.unit.js')
| -rw-r--r-- | test/fake.unit.js | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/test/fake.unit.js b/test/fake.unit.js index 6a802ec4..2ab6b4c0 100644 --- a/test/fake.unit.js +++ b/test/fake.unit.js @@ -1,51 +1,51 @@ if (typeof module !== 'undefined') { - var assert = require('assert'); - var sinon = require('sinon'); - var faker = require('../index'); + var assert = require('assert'); + var sinon = require('sinon'); + var faker = require('../index'); } describe("fake.js", function () { - describe("fake()", function () { - it("replaces a token with a random value for a method with no parameters", function () { - var name = faker.fake('{{phone.phoneNumber}}'); - assert.ok(name.match(/\d/)); - }); - - it("replaces multiple tokens with random values for methods with no parameters", function () { - var name = faker.fake('{{helpers.randomize}}{{helpers.randomize}}{{helpers.randomize}}'); - assert.ok(name.match(/[abc]{3}/)); - }); - - it("replaces a token with a random value for a methods with a simple parameter", function () { - var arr = ["one", "two", "three"]; - var random = faker.fake('{{helpers.slugify("Will This Work")}}'); - assert.ok(random === "Will-This-Work"); - }); - - it("replaces a token with a random value for a method with an array parameter", function () { - var arr = ["one", "two", "three"]; - var random = faker.fake('{{helpers.randomize(["one", "two", "three"])}}'); - assert.ok(arr.indexOf(random) > -1); - }); - - it("does not allow undefined parameters", function () { - assert.throws(function () { - faker.fake() - }, Error); - }); - - it("does not allow invalid module name", function () { - assert.throws(function () { - faker.fake('{{foo.bar}}') - }, Error); - }); - - it("does not allow invalid method name", function () { - assert.throws(function () { - faker.fake('{{address.foo}}') - }, Error); - }); + describe("fake()", function () { + it("replaces a token with a random value for a method with no parameters", function () { + var name = faker.fake('{{phone.phoneNumber}}'); + assert.ok(name.match(/\d/)); + }); + + it("replaces multiple tokens with random values for methods with no parameters", function () { + var name = faker.fake('{{helpers.randomize}}{{helpers.randomize}}{{helpers.randomize}}'); + assert.ok(name.match(/[abc]{3}/)); + }); + + it("replaces a token with a random value for a methods with a simple parameter", function () { + var arr = ["one", "two", "three"]; + var random = faker.fake('{{helpers.slugify("Will This Work")}}'); + assert.ok(random === "Will-This-Work"); + }); + + it("replaces a token with a random value for a method with an array parameter", function () { + var arr = ["one", "two", "three"]; + var random = faker.fake('{{helpers.randomize(["one", "two", "three"])}}'); + assert.ok(arr.indexOf(random) > -1); + }); + + it("does not allow undefined parameters", function () { + assert.throws(function () { + faker.fake() + }, Error); + }); + it("does not allow invalid module name", function () { + assert.throws(function () { + faker.fake('{{foo.bar}}') + }, Error); + }); + it("does not allow invalid method name", function () { + assert.throws(function () { + faker.fake('{{address.foo}}') + }, Error); }); + + + }); }); |
