diff --git a/packages/n4s/src/rules/__tests__/equals.test.ts b/packages/n4s/src/rules/__tests__/equals.test.ts index be2760ca1..95966f4d5 100644 --- a/packages/n4s/src/rules/__tests__/equals.test.ts +++ b/packages/n4s/src/rules/__tests__/equals.test.ts @@ -3,14 +3,12 @@ import { sample } from 'lodash'; import { equals } from 'equals'; -const { random, datatype } = faker; - const VALUES = [ - random.word(), - datatype.number(), - { [random.alpha()]: random.word() }, - [datatype.number()], - datatype.boolean(), + faker.lorem.word(), + faker.number.int(), + { [faker.lorem.slug()]: faker.lorem.word() }, + [faker.number.int()], + faker.datatype.boolean(), ]; const LOOSE_PAIRS = [ diff --git a/packages/n4s/src/rules/__tests__/greaterThanOrEquals.test.ts b/packages/n4s/src/rules/__tests__/greaterThanOrEquals.test.ts index 20e70a4c0..60cab3a08 100644 --- a/packages/n4s/src/rules/__tests__/greaterThanOrEquals.test.ts +++ b/packages/n4s/src/rules/__tests__/greaterThanOrEquals.test.ts @@ -2,13 +2,11 @@ import { faker } from '@faker-js/faker'; import { greaterThanOrEquals } from 'greaterThanOrEquals'; -const { random, datatype } = faker; - describe('Tests greaterThanOrEquals rule', () => { describe('Arguments are numbers', () => { let arg0: number; beforeEach(() => { - arg0 = datatype.number(); + arg0 = faker.number.int(); }); describe('When first argument is larger', () => { @@ -51,11 +49,13 @@ describe('Tests greaterThanOrEquals rule', () => { }); describe('Arguments are non numeric', () => { - [random.word(), `${datatype.number()}`.split(''), {}].forEach(element => { - it('Should return false', () => { - // @ts-expect-error - Testing invalid input - expect(greaterThanOrEquals(element, 0)).toBe(false); - }); - }); + [faker.lorem.word(), `${faker.number.int()}`.split(''), {}].forEach( + element => { + it('Should return false', () => { + // @ts-expect-error - Testing invalid input + expect(greaterThanOrEquals(element, 0)).toBe(false); + }); + } + ); }); }); diff --git a/packages/n4s/src/rules/__tests__/isEven.test.ts b/packages/n4s/src/rules/__tests__/isEven.test.ts index 49f5e96a7..c96438f06 100644 --- a/packages/n4s/src/rules/__tests__/isEven.test.ts +++ b/packages/n4s/src/rules/__tests__/isEven.test.ts @@ -60,7 +60,7 @@ describe('Tests isEven rule', () => { describe('When value is non numeric', () => { it('Should return false', () => { [ - faker.random.word(), + faker.lorem.word(), [], new Function(), new Object(), diff --git a/packages/n4s/src/rules/__tests__/isOdd.test.ts b/packages/n4s/src/rules/__tests__/isOdd.test.ts index f5ddf7d0d..a4cf24efb 100644 --- a/packages/n4s/src/rules/__tests__/isOdd.test.ts +++ b/packages/n4s/src/rules/__tests__/isOdd.test.ts @@ -60,7 +60,7 @@ describe('Tests isOdd rule', () => { describe('When value is non numeric', () => { it('Should return false', () => { [ - faker.random.word(), + faker.lorem.word(), [], new Function(), new Object(), diff --git a/packages/n4s/src/rules/__tests__/lessThan.test.ts b/packages/n4s/src/rules/__tests__/lessThan.test.ts index c689b6dda..a79f53b7c 100644 --- a/packages/n4s/src/rules/__tests__/lessThan.test.ts +++ b/packages/n4s/src/rules/__tests__/lessThan.test.ts @@ -2,13 +2,11 @@ import { faker } from '@faker-js/faker'; import { lessThan } from 'lessThan'; -const { random, datatype } = faker; - describe('Tests lessThan rule', () => { describe('Arguments are numbers', () => { let arg0: number = 0; beforeEach(() => { - arg0 = datatype.number(); + arg0 = faker.number.int(); }); describe('When first argument is larger', () => { @@ -33,7 +31,7 @@ describe('Tests lessThan rule', () => { describe('Arguments are numeric strings', () => { let arg0: string = '0'; beforeEach(() => { - arg0 = datatype.number().toString(); + arg0 = faker.number.int().toString(); }); describe('When first argument is larger', () => { it('Should return true', () => { @@ -55,11 +53,13 @@ describe('Tests lessThan rule', () => { }); describe('Arguments are non numeric', () => { - [random.word(), `${datatype.number()}`.split(''), {}].forEach(element => { - it('Should return false', () => { - // @ts-expect-error - Testing invalid input - expect(lessThan(element, 0)).toBe(false); - }); - }); + [faker.lorem.word(), `${faker.number.int()}`.split(''), {}].forEach( + element => { + it('Should return false', () => { + // @ts-expect-error - Testing invalid input + expect(lessThan(element, 0)).toBe(false); + }); + } + ); }); }); diff --git a/packages/n4s/src/rules/__tests__/lessThanOrEquals.test.ts b/packages/n4s/src/rules/__tests__/lessThanOrEquals.test.ts index 1c0b4f053..8cddf08e7 100644 --- a/packages/n4s/src/rules/__tests__/lessThanOrEquals.test.ts +++ b/packages/n4s/src/rules/__tests__/lessThanOrEquals.test.ts @@ -2,13 +2,11 @@ import { faker } from '@faker-js/faker'; import { lessThanOrEquals } from 'lessThanOrEquals'; -const { random, datatype } = faker; - describe('Tests lessThanOrEquals rule', () => { describe('Arguments are numbers', () => { let arg0: number; beforeEach(() => { - arg0 = datatype.number(); + arg0 = faker.number.int(); }); describe('When first argument is larger', () => { @@ -33,7 +31,7 @@ describe('Tests lessThanOrEquals rule', () => { describe('Arguments are numeric strings', () => { let arg0: string; beforeEach(() => { - arg0 = datatype.number().toString(); + arg0 = faker.number.int().toString(); }); describe('When first argument is larger', () => { it('Should return true', () => { @@ -55,11 +53,13 @@ describe('Tests lessThanOrEquals rule', () => { }); describe('Arguments are non numeric', () => { - [random.word(), `${datatype.number()}`.split(''), {}].forEach(element => { - it('Should return false', () => { - // @ts-expect-error - Testing invalid input - expect(lessThanOrEquals(element, 0)).toBe(false); - }); - }); + [faker.lorem.word(), `${faker.number.int()}`.split(''), {}].forEach( + element => { + it('Should return false', () => { + // @ts-expect-error - Testing invalid input + expect(lessThanOrEquals(element, 0)).toBe(false); + }); + } + ); }); }); diff --git a/packages/n4s/src/rules/__tests__/longerThanOrEquals.test.ts b/packages/n4s/src/rules/__tests__/longerThanOrEquals.test.ts index 7d467799a..132297d37 100644 --- a/packages/n4s/src/rules/__tests__/longerThanOrEquals.test.ts +++ b/packages/n4s/src/rules/__tests__/longerThanOrEquals.test.ts @@ -3,8 +3,8 @@ import { faker } from '@faker-js/faker'; import { longerThanOrEquals } from 'longerThanOrEquals'; describe('Tests longerThanOrEquals rule', () => { - const length = faker.datatype.number(); - const word = faker.random.word(); + const length = 10; + const word = faker.lorem.word(); const boolean = faker.datatype.boolean(); describe('First argument is array or string', () => { diff --git a/packages/n4s/src/rules/__tests__/shorterThan.test.ts b/packages/n4s/src/rules/__tests__/shorterThan.test.ts index cc3d7e8a4..59e9faff8 100644 --- a/packages/n4s/src/rules/__tests__/shorterThan.test.ts +++ b/packages/n4s/src/rules/__tests__/shorterThan.test.ts @@ -3,8 +3,8 @@ import { faker } from '@faker-js/faker'; import { shorterThan } from 'shorterThan'; describe('Tests shorterThan rule', () => { - const length = faker.datatype.number(); - const word = faker.random.word(); + const length = 10; + const word = faker.lorem.word(); const boolean = faker.datatype.boolean(); describe('First argument is array or string', () => { diff --git a/packages/n4s/src/rules/__tests__/shorterThanOrEquals.test.ts b/packages/n4s/src/rules/__tests__/shorterThanOrEquals.test.ts index fd2fa0b74..17fa41a34 100644 --- a/packages/n4s/src/rules/__tests__/shorterThanOrEquals.test.ts +++ b/packages/n4s/src/rules/__tests__/shorterThanOrEquals.test.ts @@ -3,8 +3,8 @@ import { faker } from '@faker-js/faker'; import { shorterThanOrEquals } from 'shorterThanOrEquals'; describe('Tests shorterThanOrEquals rule', () => { - const length = faker.datatype.number(); - const word = faker.random.word(); + const length = 10; + const word = faker.lorem.word(); const boolean = faker.datatype.boolean(); describe('First argument is array or string', () => { diff --git a/packages/vest-utils/src/__tests__/greaterThan.test.ts b/packages/vest-utils/src/__tests__/greaterThan.test.ts index caf7793be..8badeedb8 100644 --- a/packages/vest-utils/src/__tests__/greaterThan.test.ts +++ b/packages/vest-utils/src/__tests__/greaterThan.test.ts @@ -2,14 +2,12 @@ import { faker } from '@faker-js/faker'; import { greaterThan } from 'greaterThan'; -const { random, datatype } = faker; - describe('Tests greaterThan rule', () => { describe('Arguments are numbers', () => { let arg0: number; beforeEach(() => { - arg0 = datatype.number(); + arg0 = faker.number.int(); }); describe('When first argument is larger', () => { @@ -35,7 +33,7 @@ describe('Tests greaterThan rule', () => { let arg0: string; beforeEach(() => { - arg0 = datatype.number().toString(); + arg0 = faker.number.int().toString(); }); describe('When first argument is larger', () => { @@ -58,11 +56,13 @@ describe('Tests greaterThan rule', () => { }); describe('Arguments are non numeric', () => { - [random.word(), `${datatype.number()}`.split(''), {}].forEach(element => { - it('Should return false', () => { - // @ts-expect-error - testing invalid input - expect(greaterThan(element, 0)).toBe(false); - }); - }); + [faker.lorem.word(), `${faker.number.int()}`.split(''), {}].forEach( + element => { + it('Should return false', () => { + // @ts-expect-error - testing invalid input + expect(greaterThan(element, 0)).toBe(false); + }); + } + ); }); }); diff --git a/packages/vest-utils/src/__tests__/lengthEquals.test.ts b/packages/vest-utils/src/__tests__/lengthEquals.test.ts index 0ab2acb09..4127820ae 100644 --- a/packages/vest-utils/src/__tests__/lengthEquals.test.ts +++ b/packages/vest-utils/src/__tests__/lengthEquals.test.ts @@ -3,8 +3,8 @@ import { faker } from '@faker-js/faker'; import { lengthEquals } from 'lengthEquals'; describe('Tests lengthEquals rule', () => { - const length = faker.datatype.number(); - const word = faker.random.word(); + const length = 10; + const word = faker.lorem.word(); const boolean = faker.datatype.boolean(); describe('First argument is array or string', () => { diff --git a/packages/vest-utils/src/__tests__/longerThan.test.ts b/packages/vest-utils/src/__tests__/longerThan.test.ts index 453a2ce51..f0fe31f2e 100644 --- a/packages/vest-utils/src/__tests__/longerThan.test.ts +++ b/packages/vest-utils/src/__tests__/longerThan.test.ts @@ -3,8 +3,8 @@ import { faker } from '@faker-js/faker'; import { longerThan } from 'longerThan'; describe('Tests longerThan rule', () => { - const length = faker.datatype.number(); - const word = faker.random.word(); + const length = 10; + const word = faker.lorem.word(); const boolean = faker.datatype.boolean(); describe('First argument is array or string', () => { diff --git a/packages/vest-utils/src/__tests__/numberEquals.test.ts b/packages/vest-utils/src/__tests__/numberEquals.test.ts index 35ff35298..9dda865d2 100644 --- a/packages/vest-utils/src/__tests__/numberEquals.test.ts +++ b/packages/vest-utils/src/__tests__/numberEquals.test.ts @@ -2,13 +2,11 @@ import { faker } from '@faker-js/faker'; import { numberEquals } from 'numberEquals'; -const { random, datatype } = faker; - describe('Tests numberEquals rule', () => { describe('Arguments are numbers', () => { let arg0: number; beforeEach(() => { - arg0 = datatype.number(); + arg0 = faker.number.int(); }); describe('When first argument is larger', () => { @@ -34,7 +32,7 @@ describe('Tests numberEquals rule', () => { let arg0: string; beforeEach(() => { - arg0 = datatype.number().toString(); + arg0 = faker.number.int().toString(); }); describe('When first argument is larger', () => { @@ -57,11 +55,13 @@ describe('Tests numberEquals rule', () => { }); describe('Arguments are non numeric', () => { - [random.word(), `${datatype.number()}`.split(''), {}].forEach(element => { - it('Should return false', () => { - // @ts-expect-error - testing invalid input - expect(numberEquals(element, 0)).toBe(false); - }); - }); + [faker.lorem.word(), `${faker.number.int()}`.split(''), {}].forEach( + element => { + it('Should return false', () => { + // @ts-expect-error - testing invalid input + expect(numberEquals(element, 0)).toBe(false); + }); + } + ); }); }); diff --git a/packages/vest/src/core/test/__tests__/test.test.ts b/packages/vest/src/core/test/__tests__/test.test.ts index a60229813..2798ca82b 100644 --- a/packages/vest/src/core/test/__tests__/test.test.ts +++ b/packages/vest/src/core/test/__tests__/test.test.ts @@ -18,7 +18,7 @@ describe("Test Vest's `test` function", () => { it('Should be marked as warning when the warn hook gets called', () => { vest.create(() => { testObject = vest.test( - faker.random.word(), + faker.lorem.word(), faker.lorem.sentence(), () => { vest.warn(); @@ -33,7 +33,7 @@ describe("Test Vest's `test` function", () => { it('Should be marked as failed after a thrown error', () => { vest.create(() => { testObject = vest.test( - faker.random.word(), + faker.lorem.word(), faker.lorem.sentence(), () => { throw new Error(); @@ -45,7 +45,7 @@ describe("Test Vest's `test` function", () => { it('Should be marked as failed for an explicit false return', () => { vest.create(() => { - vest.test(faker.random.word(), faker.lorem.sentence(), () => false); + vest.test(faker.lorem.word(), faker.lorem.sentence(), () => false); })(); expect(VestTest.isFailing(testObject)).toBe(true); }); @@ -126,7 +126,7 @@ describe("Test Vest's `test` function", () => { TestPromise(done => { vest.create(() => { testObject = vest.test( - faker.random.word(), + faker.lorem.word(), faker.lorem.sentence(), () => new Promise((_, reject) => { diff --git a/packages/vest/src/exports/__tests__/promisify.test.ts b/packages/vest/src/exports/__tests__/promisify.test.ts index 39f7da5c7..7385e5d72 100644 --- a/packages/vest/src/exports/__tests__/promisify.test.ts +++ b/packages/vest/src/exports/__tests__/promisify.test.ts @@ -60,9 +60,9 @@ describe('Utility: promisify', () => { it('Passes all arguments over to tests callback', async () => { const params = [ 1, - { [faker.random.word()]: [1, 2, 3] }, + { [faker.lorem.word()]: [1, 2, 3] }, false, - [faker.random.word()], + [faker.lorem.word()], ]; await validateAsync(...params); diff --git a/packages/vest/src/suite/__tests__/create.test.ts b/packages/vest/src/suite/__tests__/create.test.ts index 79a28e685..75ddfc131 100644 --- a/packages/vest/src/suite/__tests__/create.test.ts +++ b/packages/vest/src/suite/__tests__/create.test.ts @@ -17,7 +17,7 @@ describe('Test createSuite module', () => { expect(create(jest.fn()).get()).toMatchSnapshot(); }); - it.each([faker.random.word(), null, undefined, 0, 1, true, false, NaN, ''])( + it.each([faker.lorem.word(), null, undefined, 0, 1, true, false, NaN, ''])( 'Throws an error when `tests` callback is not a function', value => { // @ts-expect-error - testing invalid input @@ -57,9 +57,9 @@ describe('Test createSuite module', () => { 1, 2, 3, - { [faker.random.word()]: [1, 2, 3] }, + { [faker.lorem.word()]: [1, 2, 3] }, false, - [faker.random.word()], + [faker.lorem.word()], ]; const validate = create(testsCallback); validate(...params); diff --git a/packages/vest/src/suiteResult/selectors/__tests__/hasFailures.test.ts b/packages/vest/src/suiteResult/selectors/__tests__/hasFailures.test.ts index 233ea5d9f..99def221c 100644 --- a/packages/vest/src/suiteResult/selectors/__tests__/hasFailures.test.ts +++ b/packages/vest/src/suiteResult/selectors/__tests__/hasFailures.test.ts @@ -5,7 +5,7 @@ import { dummyTest } from '../../../testUtils/testDummy'; import * as vest from 'vest'; describe('produce method: hasFailures', () => { - const fieldName = faker.random.word(); + const fieldName = faker.lorem.word(); describe(`hasErrors`, () => { describe('When no test objects', () => { diff --git a/packages/vest/src/suiteResult/selectors/__tests__/hasFailuresByGroup.test.ts b/packages/vest/src/suiteResult/selectors/__tests__/hasFailuresByGroup.test.ts index aee2e3484..a2bfe9e85 100644 --- a/packages/vest/src/suiteResult/selectors/__tests__/hasFailuresByGroup.test.ts +++ b/packages/vest/src/suiteResult/selectors/__tests__/hasFailuresByGroup.test.ts @@ -5,7 +5,7 @@ import { dummyTest } from '../../../testUtils/testDummy'; import { TTestSuite } from 'testUtils/TVestMock'; import * as vest from 'vest'; -const fieldName = faker.random.word(); +const fieldName = faker.lorem.word(); const groupName = faker.lorem.word(); let suite: TTestSuite; @@ -166,9 +166,9 @@ describe('hasWarningsByGroup', () => { dummyTest.failingWarning(fieldName, 'msg'); }); }); - expect(suite().hasWarningsByGroup(groupName, 'non_matching_field')).toBe( - false - ); + expect( + suite().hasWarningsByGroup(groupName, 'non_matching_field') + ).toBe(false); }); }); diff --git a/packages/vest/src/suiteResult/selectors/__tests__/hasFailuresByTestObject.test.ts b/packages/vest/src/suiteResult/selectors/__tests__/hasFailuresByTestObject.test.ts index d62b6f4fa..8681915f4 100644 --- a/packages/vest/src/suiteResult/selectors/__tests__/hasFailuresByTestObject.test.ts +++ b/packages/vest/src/suiteResult/selectors/__tests__/hasFailuresByTestObject.test.ts @@ -6,13 +6,13 @@ import { Severity } from 'Severity'; import { hasFailuresByTestObject } from 'hasFailuresByTestObjects'; import { mockIsolateTest } from 'vestMocks'; -const fieldName: string = faker.random.word(); +const fieldName: string = faker.lorem.word(); describe('hasFailuresByTestObject', () => { let testObject: TIsolateTest; beforeEach(() => { - const fieldName: string = faker.random.word(); + const fieldName: string = faker.lorem.word(); testObject = mockIsolateTest({ fieldName, }); diff --git a/packages/vest/src/testUtils/testDummy.ts b/packages/vest/src/testUtils/testDummy.ts index c43c29f76..ab2f1fe85 100644 --- a/packages/vest/src/testUtils/testDummy.ts +++ b/packages/vest/src/testUtils/testDummy.ts @@ -9,8 +9,8 @@ import { test as vestTest, warn } from 'vest'; // eslint-disable-next-line max-lines-per-function const testDummy = () => { const failing = ( - name: string = faker.random.word(), - message: string = faker.random.words() + name: string = faker.lorem.word(), + message: string = faker.lorem.words() ) => { const to = vestTest( name, @@ -24,8 +24,8 @@ const testDummy = () => { }; const failingWarning = ( - name = faker.random.word(), - message = faker.random.words() + name = faker.lorem.word(), + message = faker.lorem.words() ) => { const to = vestTest( name, @@ -40,8 +40,8 @@ const testDummy = () => { }; const passing = ( - name = faker.random.word(), - message = faker.random.words() + name = faker.lorem.word(), + message = faker.lorem.words() ) => { const to = vestTest(name, message, jest.fn()); @@ -49,8 +49,8 @@ const testDummy = () => { }; const passingWarning = ( - name = faker.random.word(), - message = faker.random.words() + name = faker.lorem.word(), + message = faker.lorem.words() ) => { const to = vestTest( name, @@ -63,8 +63,8 @@ const testDummy = () => { }; const failingAsync = ( - name = faker.random.word(), - { message = faker.random.words(), time = 0 } = {} + name = faker.lorem.word(), + { message = faker.lorem.words(), time = 0 } = {} ) => vestTest( name, @@ -78,8 +78,8 @@ const testDummy = () => { ); const failingWarningAsync = ( - name = faker.random.word(), - { message = faker.random.words(), time = 0 } = {} + name = faker.lorem.word(), + { message = faker.lorem.words(), time = 0 } = {} ) => vestTest( name, @@ -93,8 +93,8 @@ const testDummy = () => { ); const passingAsync = ( - name = faker.random.word(), - { message = faker.random.words(), time = 0 } = {} + name = faker.lorem.word(), + { message = faker.lorem.words(), time = 0 } = {} ) => vestTest( name, @@ -108,8 +108,8 @@ const testDummy = () => { ); const passingWarningAsync = ( - name = faker.random.word(), - { message = faker.random.words(), time = 0 } = {} + name = faker.lorem.word(), + { message = faker.lorem.words(), time = 0 } = {} ) => vestTest( name,