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/unique.unit.js | |
| parent | 0b75623dac94f6062ae623fa8bbfe0e81b205d4d (diff) | |
| download | faker-10dd7e30cf49f03c34da1ab540df2172be40c8ea.tar.xz faker-10dd7e30cf49f03c34da1ab540df2172be40c8ea.zip | |
Linting fixes for `./test`
Diffstat (limited to 'test/unique.unit.js')
| -rw-r--r-- | test/unique.unit.js | 94 |
1 files changed, 47 insertions, 47 deletions
diff --git a/test/unique.unit.js b/test/unique.unit.js index 3681e0b3..b312fb7f 100644 --- a/test/unique.unit.js +++ b/test/unique.unit.js @@ -1,54 +1,54 @@ 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("unique.js", function () { - describe("unique()", function () { - - it("is able to call a function with no arguments and return a result", function () { - var result = faker.unique(faker.internet.email); - assert.strictEqual(typeof result, 'string'); - }); - - it("is able to call a function with arguments and return a result", function () { - var result = faker.unique(faker.internet.email, ['a', 'b', 'c']); // third argument is provider, or domain for email - assert.ok(result.match(/\@c/)); - }); - - it("is able to call same function with arguments and return a result", function () { - var result = faker.unique(faker.internet.email, ['a', 'b', 'c']); // third argument is provider, or domain for email - assert.ok(result.match(/\@c/)); - }); - - it("is able to exclude results as array", function () { - var result = faker.unique(faker.internet.protocol, [], { exclude: ['https'] }); - assert.strictEqual(result, 'http'); - }); - - it("is able to limit unique call by maxTime in ms", function () { - var result; - try { - result = faker.unique(faker.internet.protocol, [], { maxTime: 1, maxRetries: 9999, exclude: ['https', 'http'] }); - } catch (err) { - assert.strictEqual(err.message.substr(0, 16), 'Exceeded maxTime'); - } - }); - - it("is able to limit unique call by maxRetries", function () { - var result; - try { - result = faker.unique(faker.internet.protocol, [], { maxTime: 5000, maxRetries: 5, exclude: ['https', 'http'] }); - } catch (err) { - assert.strictEqual(err.message.substr(0, 19), 'Exceeded maxRetries'); - } - }); - - it("is able to call last function with arguments and return a result", function () { - var result = faker.unique(faker.internet.email, ['a', 'b', 'c']); // third argument is provider, or domain for email - assert.ok(result.match(/\@c/)); - }); + describe("unique()", function () { + it("is able to call a function with no arguments and return a result", function () { + var result = faker.unique(faker.internet.email); + assert.strictEqual(typeof result, 'string'); }); + + it("is able to call a function with arguments and return a result", function () { + var result = faker.unique(faker.internet.email, ['a', 'b', 'c']); // third argument is provider, or domain for email + assert.ok(result.match(/\@c/)); + }); + + it("is able to call same function with arguments and return a result", function () { + var result = faker.unique(faker.internet.email, ['a', 'b', 'c']); // third argument is provider, or domain for email + assert.ok(result.match(/\@c/)); + }); + + it("is able to exclude results as array", function () { + var result = faker.unique(faker.internet.protocol, [], { exclude: ['https'] }); + assert.strictEqual(result, 'http'); + }); + + it("is able to limit unique call by maxTime in ms", function () { + var result; + try { + result = faker.unique(faker.internet.protocol, [], { maxTime: 1, maxRetries: 9999, exclude: ['https', 'http'] }); + } catch (err) { + assert.strictEqual(err.message.substr(0, 16), 'Exceeded maxTime'); + } + }); + + it("is able to limit unique call by maxRetries", function () { + var result; + try { + result = faker.unique(faker.internet.protocol, [], { maxTime: 5000, maxRetries: 5, exclude: ['https', 'http'] }); + } catch (err) { + assert.strictEqual(err.message.substr(0, 19), 'Exceeded maxRetries'); + } + }); + + it("is able to call last function with arguments and return a result", function () { + var result = faker.unique(faker.internet.email, ['a', 'b', 'c']); // third argument is provider, or domain for email + assert.ok(result.match(/\@c/)); + }); + + }); }); |
