aboutsummaryrefslogtreecommitdiff
path: root/test/unique.unit.js
diff options
context:
space:
mode:
authorShinigami <[email protected]>2022-01-21 22:29:24 +0100
committerGitHub <[email protected]>2022-01-21 22:29:24 +0100
commit60c90028ba76b7e291fdb8152425b93c41b117c9 (patch)
treecfaf146a883f902acc351c7c2cba095c459ec36f /test/unique.unit.js
parent2da0cec2f91f54f56b509414a8b29b3831d58412 (diff)
downloadfaker-60c90028ba76b7e291fdb8152425b93c41b117c9.tar.xz
faker-60c90028ba76b7e291fdb8152425b93c41b117c9.zip
chore(test): migrate to vitest (#235)
Diffstat (limited to 'test/unique.unit.js')
-rw-r--r--test/unique.unit.js62
1 files changed, 0 insertions, 62 deletions
diff --git a/test/unique.unit.js b/test/unique.unit.js
deleted file mode 100644
index d500243e..00000000
--- a/test/unique.unit.js
+++ /dev/null
@@ -1,62 +0,0 @@
-if (typeof module !== 'undefined') {
- var assert = require('assert');
- var sinon = require('sinon');
- var faker = require('../lib').faker;
-}
-
-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/));
- });
- });
-});