diff --git a/.github/renovate.json5 b/.github/renovate.json5 index 8df226abc11..616f819905b 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -9,6 +9,14 @@ "groupName": "typescript-eslint", "matchPackagePrefixes": ["@typescript-eslint/"] }, + { + "groupName": "doc-dependencies", + "matchPackagePrefixes": [ + "typedoc", + "typedoc-plugin-missing-exports", + "vitepress" + ] + }, { "groupName": "vitest", "matchPackagePrefixes": ["@vitest/ui", "vitest"] diff --git a/package.json b/package.json index 98391306da1..20248dd3f0a 100644 --- a/package.json +++ b/package.json @@ -96,7 +96,7 @@ "@vitest/ui": "~0.3.4", "c8": "~7.11.0", "conventional-changelog-cli": "~2.2.2", - "cypress": "~9.4.1", + "cypress": "~9.5.0", "esbuild": "~0.14.21", "eslint": "~8.9.0", "eslint-config-prettier": "~8.3.0", @@ -116,11 +116,11 @@ "typedoc-plugin-missing-exports": "~0.22.6", "typescript": "~4.5.5", "validator": "~13.7.0", - "vite": "~2.8.1", - "vitepress": "~0.22.0", + "vite": "~2.8.3", + "vitepress": "~0.22.2", "vitest": "~0.3.4" }, - "packageManager": "pnpm@6.30.1", + "packageManager": "pnpm@6.31.0", "engines": { "node": ">=14.0.0", "npm": ">=7.0.0" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a191060071e..d5e47a12a2f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,7 +9,7 @@ specifiers: '@vitest/ui': ~0.3.4 c8: ~7.11.0 conventional-changelog-cli: ~2.2.2 - cypress: ~9.4.1 + cypress: ~9.5.0 esbuild: ~0.14.21 eslint: ~8.9.0 eslint-config-prettier: ~8.3.0 @@ -29,8 +29,8 @@ specifiers: typedoc-plugin-missing-exports: ~0.22.6 typescript: ~4.5.5 validator: ~13.7.0 - vite: ~2.8.1 - vitepress: ~0.22.0 + vite: ~2.8.3 + vitepress: ~0.22.2 vitest: ~0.3.4 devDependencies: @@ -42,7 +42,7 @@ devDependencies: '@vitest/ui': 0.3.4 c8: 7.11.0 conventional-changelog-cli: 2.2.2 - cypress: 9.4.1 + cypress: 9.5.0 esbuild: 0.14.21 eslint: 8.9.0 eslint-config-prettier: 8.3.0_eslint@8.9.0 @@ -62,8 +62,8 @@ devDependencies: typedoc-plugin-missing-exports: 0.22.6_typedoc@0.22.11 typescript: 4.5.5 validator: 13.7.0 - vite: 2.8.1 - vitepress: 0.22.0 + vite: 2.8.3 + vitepress: 0.22.2 vitest: 0.3.4_@vitest+ui@0.3.4+c8@7.11.0 packages: @@ -531,15 +531,15 @@ packages: eslint-visitor-keys: 3.3.0 dev: true - /@vitejs/plugin-vue/2.2.0_vite@2.8.1+vue@3.2.30: + /@vitejs/plugin-vue/2.2.0_vite@2.8.3+vue@3.2.31: resolution: {integrity: sha512-wXigM1EwN2G7rZcwG6kLk9ivvIMhx2363tCEvMBiXcTu5nePM/12hUPVzPb83Uugt6U+zom1gTpJopi/Ow/jwg==} engines: {node: '>=12.0.0'} peerDependencies: vite: ^2.5.10 vue: ^3.2.25 dependencies: - vite: 2.8.1 - vue: 3.2.30 + vite: 2.8.3 + vue: 3.2.31 dev: true /@vitest/ui/0.3.4: @@ -548,87 +548,87 @@ packages: sirv: 2.0.2 dev: true - /@vue/compiler-core/3.2.30: - resolution: {integrity: sha512-64fq1KfcR+k3Vlw+IsBM2VhV5B+2IP3YxvKU8LWCDLrkmlXtbf2eMK6+0IwX5KP41D0f1gzryIiXR7P8cB9O5Q==} + /@vue/compiler-core/3.2.31: + resolution: {integrity: sha512-aKno00qoA4o+V/kR6i/pE+aP+esng5siNAVQ422TkBNM6qA4veXiZbSe8OTXHXquEi/f6Akc+nLfB4JGfe4/WQ==} dependencies: '@babel/parser': 7.17.0 - '@vue/shared': 3.2.30 + '@vue/shared': 3.2.31 estree-walker: 2.0.2 source-map: 0.6.1 dev: true - /@vue/compiler-dom/3.2.30: - resolution: {integrity: sha512-t7arHz2SXLCXlF2fdGDFVbhENbGMez254Z5edUqb//6WXJU1lC7GvSkUE7i5x8WSjgfqt60i0V8zdmk16rvLdw==} + /@vue/compiler-dom/3.2.31: + resolution: {integrity: sha512-60zIlFfzIDf3u91cqfqy9KhCKIJgPeqxgveH2L+87RcGU/alT6BRrk5JtUso0OibH3O7NXuNOQ0cDc9beT0wrg==} dependencies: - '@vue/compiler-core': 3.2.30 - '@vue/shared': 3.2.30 + '@vue/compiler-core': 3.2.31 + '@vue/shared': 3.2.31 dev: true - /@vue/compiler-sfc/3.2.30: - resolution: {integrity: sha512-P/5YpILtcQY92z72gxhkyOUPHVskEzhSrvYi91Xcr+csOxaDaYU5OqOxCzZKcf3Og70Tat404vO1OHrwprN90A==} + /@vue/compiler-sfc/3.2.31: + resolution: {integrity: sha512-748adc9msSPGzXgibHiO6T7RWgfnDcVQD+VVwYgSsyyY8Ans64tALHZANrKtOzvkwznV/F4H7OAod/jIlp/dkQ==} dependencies: '@babel/parser': 7.17.0 - '@vue/compiler-core': 3.2.30 - '@vue/compiler-dom': 3.2.30 - '@vue/compiler-ssr': 3.2.30 - '@vue/reactivity-transform': 3.2.30 - '@vue/shared': 3.2.30 + '@vue/compiler-core': 3.2.31 + '@vue/compiler-dom': 3.2.31 + '@vue/compiler-ssr': 3.2.31 + '@vue/reactivity-transform': 3.2.31 + '@vue/shared': 3.2.31 estree-walker: 2.0.2 magic-string: 0.25.7 postcss: 8.4.6 source-map: 0.6.1 dev: true - /@vue/compiler-ssr/3.2.30: - resolution: {integrity: sha512-OUh3MwAu/PsD7VN3UOdBbTkltkrUCNouSht47+CMRzpUR5+ta7+xyMAVHeq8wg4YZenWaJimbR5TL35Ka4Vk6g==} + /@vue/compiler-ssr/3.2.31: + resolution: {integrity: sha512-mjN0rqig+A8TVDnsGPYJM5dpbjlXeHUm2oZHZwGyMYiGT/F4fhJf/cXy8QpjnLQK4Y9Et4GWzHn9PS8AHUnSkw==} dependencies: - '@vue/compiler-dom': 3.2.30 - '@vue/shared': 3.2.30 + '@vue/compiler-dom': 3.2.31 + '@vue/shared': 3.2.31 dev: true - /@vue/reactivity-transform/3.2.30: - resolution: {integrity: sha512-Le5XzCJyK3qTjoTnvQG/Ehu8fYjayauMNFyMaEnwFlm/avDofpuibpS9u+/6AgzsGnVWN+i0Jgf25bJd9DIwMw==} + /@vue/reactivity-transform/3.2.31: + resolution: {integrity: sha512-uS4l4z/W7wXdI+Va5pgVxBJ345wyGFKvpPYtdSgvfJfX/x2Ymm6ophQlXXB6acqGHtXuBqNyyO3zVp9b1r0MOA==} dependencies: '@babel/parser': 7.17.0 - '@vue/compiler-core': 3.2.30 - '@vue/shared': 3.2.30 + '@vue/compiler-core': 3.2.31 + '@vue/shared': 3.2.31 estree-walker: 2.0.2 magic-string: 0.25.7 dev: true - /@vue/reactivity/3.2.30: - resolution: {integrity: sha512-qlNKbkRn2JiGxVUEdoXbLAy+vcuHUCcq+YH2uXWz0BNMvXY2plmz+oqsw+694llwmYLkke5lbdYF4DIupisIkg==} + /@vue/reactivity/3.2.31: + resolution: {integrity: sha512-HVr0l211gbhpEKYr2hYe7hRsV91uIVGFYNHj73njbARVGHQvIojkImKMaZNDdoDZOIkMsBc9a1sMqR+WZwfSCw==} dependencies: - '@vue/shared': 3.2.30 + '@vue/shared': 3.2.31 dev: true - /@vue/runtime-core/3.2.30: - resolution: {integrity: sha512-RTi7xH0Ht/6wfbo2WFBMJTEiyWFTqGhrksJm8lz6E+auO6lXZ6Eq3gPNfLt47GDWCm4xyrv+rs5R4UbarPEQ1Q==} + /@vue/runtime-core/3.2.31: + resolution: {integrity: sha512-Kcog5XmSY7VHFEMuk4+Gap8gUssYMZ2+w+cmGI6OpZWYOEIcbE0TPzzPHi+8XTzAgx1w/ZxDFcXhZeXN5eKWsA==} dependencies: - '@vue/reactivity': 3.2.30 - '@vue/shared': 3.2.30 + '@vue/reactivity': 3.2.31 + '@vue/shared': 3.2.31 dev: true - /@vue/runtime-dom/3.2.30: - resolution: {integrity: sha512-a3+jrncDvEFQmB+v9k0VyT4/Y3XO6OAueCroXXY4yLyr6PJeyxljweV5TzvW0rvVzH9sZO0QAvG76Lo+6C92Qw==} + /@vue/runtime-dom/3.2.31: + resolution: {integrity: sha512-N+o0sICVLScUjfLG7u9u5XCjvmsexAiPt17GNnaWHJUfsKed5e85/A3SWgKxzlxx2SW/Hw7RQxzxbXez9PtY3g==} dependencies: - '@vue/runtime-core': 3.2.30 - '@vue/shared': 3.2.30 + '@vue/runtime-core': 3.2.31 + '@vue/shared': 3.2.31 csstype: 2.6.19 dev: true - /@vue/server-renderer/3.2.30_vue@3.2.30: - resolution: {integrity: sha512-pzb8J/w+JdZVOtuKFlirGqrs4GP60FXGDJySw3WV2pCetuFstaacDrnymEeSo3ohAD+Qjv7zAG+Y7OvkdxQxmQ==} + /@vue/server-renderer/3.2.31_vue@3.2.31: + resolution: {integrity: sha512-8CN3Zj2HyR2LQQBHZ61HexF5NReqngLT3oahyiVRfSSvak+oAvVmu8iNLSu6XR77Ili2AOpnAt1y8ywjjqtmkg==} peerDependencies: - vue: 3.2.30 + vue: 3.2.31 dependencies: - '@vue/compiler-ssr': 3.2.30 - '@vue/shared': 3.2.30 - vue: 3.2.30 + '@vue/compiler-ssr': 3.2.31 + '@vue/shared': 3.2.31 + vue: 3.2.31 dev: true - /@vue/shared/3.2.30: - resolution: {integrity: sha512-B3HouBtUxcfu2w2d+VhdLcVBXKYYhXiFMAfQ+hoe8NUhKkPRkWDIqhpuehCZxVQ3S2dN1P1WfKGlxGC+pfmxGg==} + /@vue/shared/3.2.31: + resolution: {integrity: sha512-ymN2pj6zEjiKJZbrf98UM2pfDd6F2H7ksKw7NDt/ZZ1fh5Ei39X5tABugtT03ZRlWd9imccoK0hE8hpjpU7irQ==} dev: true /JSONStream/1.3.5: @@ -1326,8 +1326,8 @@ packages: resolution: {integrity: sha512-ZVxXaNy28/k3kJg0Fou5MiYpp88j7H9hLZp8PDC3jV0WFjfH5E9xHb56L0W59cPbKbcHXeP4qyT8PrHp8t6LcQ==} dev: true - /cypress/9.4.1: - resolution: {integrity: sha512-+JgMG9uT+QFx97JU9kOHE3jO3+0UdkQ9H1oCBiC7A74qme7Jkdy2sYDBCPjjGczutnWnGUTMRlwiNMP/Uq6LrQ==} + /cypress/9.5.0: + resolution: {integrity: sha512-rC5QPolKsVjJ8QJZ7IeZ6HlKM4gswBGZc0XvoAJNL8urQCSL8zTX0A/ai/h35WfF47NQ0iSZnwIXBlHX3MOUIQ==} engines: {node: '>=12.0.0'} hasBin: true requiresBuild: true @@ -4245,8 +4245,8 @@ packages: extsprintf: 1.3.0 dev: true - /vite/2.8.1: - resolution: {integrity: sha512-Typ8qjUnW0p53gBsJpisrKcZlEbUPZATja9BG6Z09QZjg9YrnEn/htkr/VH4WhnH7eNUQeSD+wKI1lHzQRWskw==} + /vite/2.8.3: + resolution: {integrity: sha512-967klrEiG7HEsN7fQYYVETs5495Iu6GpI7YyxoO5yVTJCRxjV8HhWgNWKgrbazjoOB9DQuztL53/nUoNqHNsWg==} engines: {node: '>=12.2.0'} hasBin: true peerDependencies: @@ -4269,17 +4269,17 @@ packages: fsevents: 2.3.2 dev: true - /vitepress/0.22.0: - resolution: {integrity: sha512-0q8OFO6mO1q6o33m7RkHl03Ef3qt2eRM3ZlkO19Q6QNC1m0fAPnV32DHLeq432IaHOfjmFo3bIJb9rptqv7VLQ==} + /vitepress/0.22.2: + resolution: {integrity: sha512-L6ykQzBXKzLTSU3zZbILeF1TONO6juV/RrL0DsA9OayomVQjEOoFY7cVdKOpIBb3T5Jy/GAAVxcvWtU/XJ5k4g==} engines: {node: '>=12.0.0'} hasBin: true dependencies: '@docsearch/css': 3.0.0-alpha.50 '@docsearch/js': 3.0.0-alpha.50 - '@vitejs/plugin-vue': 2.2.0_vite@2.8.1+vue@3.2.30 + '@vitejs/plugin-vue': 2.2.0_vite@2.8.3+vue@3.2.31 prismjs: 1.26.0 - vite: 2.8.1 - vue: 3.2.30 + vite: 2.8.3 + vue: 3.2.31 transitivePeerDependencies: - '@algolia/client-search' - '@types/react' @@ -4317,7 +4317,7 @@ packages: local-pkg: 0.4.1 tinypool: 0.1.1 tinyspy: 0.2.10 - vite: 2.8.1 + vite: 2.8.3 transitivePeerDependencies: - less - sass @@ -4332,14 +4332,14 @@ packages: resolution: {integrity: sha512-Uw5ooOQxRASHgu6C7GVvUxisKXfSgW4oFlO+aa+PAkgmH89O3CXxEEzNRNtHSqtXFTl0nAC1uYj0GMSH27uwtQ==} dev: true - /vue/3.2.30: - resolution: {integrity: sha512-ZmTFWVJUX2XADkuOB8GcLTuxnBLogjJBTNVrM7WsTnjqRQ+VR8bLNrvNsbn8vj/LaP5+0WFAPrpngOYE2x+e+Q==} + /vue/3.2.31: + resolution: {integrity: sha512-odT3W2tcffTiQCy57nOT93INw1auq5lYLLYtWpPYQQYQOOdHiqFct9Xhna6GJ+pJQaF67yZABraH47oywkJgFw==} dependencies: - '@vue/compiler-dom': 3.2.30 - '@vue/compiler-sfc': 3.2.30 - '@vue/runtime-dom': 3.2.30 - '@vue/server-renderer': 3.2.30_vue@3.2.30 - '@vue/shared': 3.2.30 + '@vue/compiler-dom': 3.2.31 + '@vue/compiler-sfc': 3.2.31 + '@vue/runtime-dom': 3.2.31 + '@vue/server-renderer': 3.2.31_vue@3.2.31 + '@vue/shared': 3.2.31 dev: true /which-boxed-primitive/1.0.2: diff --git a/test/company.spec.ts b/test/company.spec.ts index 3d9f7e0481d..05ebf6b478f 100644 --- a/test/company.spec.ts +++ b/test/company.spec.ts @@ -1,120 +1,234 @@ -import { describe, expect, it, vi } from 'vitest'; +import { afterEach, describe, expect, it } from 'vitest'; import { faker } from '../src'; -describe('company', () => { - describe('companyName()', () => { - it('sometimes returns three last names', () => { - const spy_name_lastName = vi.spyOn(faker.name, 'lastName'); - const spy_datatype_number = vi - .spyOn(faker.datatype, 'number') - .mockReturnValue(2); - - const name = faker.company.companyName(); - const parts = name.split(' '); - - expect(parts.length).toBe(4); // account for word 'and' - expect(spy_name_lastName).toHaveBeenCalledTimes(3); - - spy_datatype_number.mockRestore(); - spy_name_lastName.mockRestore(); - }); +const seededRuns = [ + { + seed: 42, + expectations: { + suffixes: ['Inc', 'and Sons', 'LLC', 'Group'], + companyName: 'Schinner - Wiegand', + companySuffix: 'and Sons', + catchPhrase: 'Implemented responsive throughput', + bs: 'seize impactful web services', + catchPhraseAdjective: 'Implemented', + catchPhraseDescriptor: 'explicit', + catchPhraseNoun: 'framework', + bsAdjective: 'dynamic', + bsBuzz: 'seize', + bsNoun: 'portals', + }, + }, + { + seed: 1337, + expectations: { + suffixes: ['Inc', 'and Sons', 'LLC', 'Group'], + companyName: 'Macejkovic Inc', + companySuffix: 'and Sons', + catchPhrase: 'Expanded leading edge capacity', + bs: 'incentivize efficient initiatives', + catchPhraseAdjective: 'Expanded', + catchPhraseDescriptor: 'demand-driven', + catchPhraseNoun: 'data-warehouse', + bsAdjective: 'global', + bsBuzz: 'incentivize', + bsNoun: 'ROI', + }, + }, + { + seed: 1211, + expectations: { + suffixes: ['Inc', 'and Sons', 'LLC', 'Group'], + companyName: 'Koch, Trantow and Sanford', + companySuffix: 'Group', + catchPhrase: 'Up-sized high-level success', + bs: 'cultivate bleeding-edge functionalities', + catchPhraseAdjective: 'Up-sized', + catchPhraseDescriptor: 'upward-trending', + catchPhraseNoun: 'system engine', + bsAdjective: 'plug-and-play', + bsBuzz: 'cultivate', + bsNoun: 'experiences', + }, + }, +]; + +const NON_SEEDED_BASED_RUN = 5; + +const functionNames = [ + 'suffixes', + 'companyName', + 'companySuffix', + 'catchPhrase', + 'bs', + 'catchPhraseAdjective', + 'catchPhraseDescriptor', + 'catchPhraseNoun', + 'bsAdjective', + 'bsBuzz', + 'bsNoun', +]; - it('sometimes returns two last names separated by a hyphen', () => { - const spy_name_lastName = vi.spyOn(faker.name, 'lastName'); - const spy_datatype_number = vi - .spyOn(faker.datatype, 'number') - .mockReturnValue(1); - - const name = faker.company.companyName(); - const parts = name.split('-'); - - expect(parts.length).greaterThanOrEqual(2); - expect(spy_name_lastName).toHaveBeenCalledTimes(2); - - spy_datatype_number.mockRestore(); - spy_name_lastName.mockRestore(); - }); - - it('sometimes returns a last name with a company suffix', () => { - const spy_company_companySuffix = vi.spyOn( - faker.company, - 'companySuffix' - ); - const spy_name_lastName = vi.spyOn(faker.name, 'lastName'); - const spy_datatype_number = vi - .spyOn(faker.datatype, 'number') - .mockReturnValue(0); - - const name = faker.company.companyName(); - const parts = name.split(' '); - - expect(parts.length).greaterThanOrEqual(2); - expect(spy_name_lastName).toHaveBeenCalledOnce(); - expect(spy_company_companySuffix).toHaveBeenCalledOnce(); - - spy_datatype_number.mockRestore(); - spy_name_lastName.mockRestore(); - spy_company_companySuffix.mockRestore(); - }); +describe('company', () => { + afterEach(() => { + faker.locale = 'en'; }); - describe('companySuffix()', () => { - it('returns random value from company.suffixes array', () => { - const suffix = faker.company.companySuffix(); - expect(faker.company.suffixes()).toContain(suffix); - }); - }); + for (const { seed, expectations } of seededRuns) { + describe(`seed: ${seed}`, () => { + for (const functionName of functionNames) { + it(`${functionName}()`, () => { + faker.seed(seed); - describe('catchPhrase()', () => { - it('returns phrase comprising of a catch phrase adjective, descriptor, and noun', () => { - const spy_random_arrayElement = vi.spyOn(faker.random, 'arrayElement'); - const spy_company_catchPhraseAdjective = vi.spyOn( - faker.company, - 'catchPhraseAdjective' - ); - const spy_company_catchPhraseDescriptor = vi.spyOn( - faker.company, - 'catchPhraseDescriptor' - ); - const spy_company_catchPhraseNoun = vi.spyOn( - faker.company, - 'catchPhraseNoun' - ); - - const phrase = faker.company.catchPhrase(); - - expect(phrase.split(' ').length).greaterThanOrEqual(3); - expect(spy_random_arrayElement).toHaveBeenCalledTimes(3); - expect(spy_company_catchPhraseAdjective).toHaveBeenCalledOnce(); - expect(spy_company_catchPhraseDescriptor).toHaveBeenCalledOnce(); - expect(spy_company_catchPhraseNoun).toHaveBeenCalledOnce(); - - spy_random_arrayElement.mockRestore(); - spy_company_catchPhraseAdjective.mockRestore(); - spy_company_catchPhraseDescriptor.mockRestore(); - spy_company_catchPhraseNoun.mockRestore(); + const actual = faker.company[functionName](); + expect(actual).toEqual(expectations[functionName]); + }); + } }); - }); + } - describe('bs()', () => { - it('returns phrase comprising of a BS buzz, adjective, and noun', () => { - const spy_random_arrayElement = vi.spyOn(faker.random, 'arrayElement'); - const spy_company_bsBuzz = vi.spyOn(faker.company, 'bsBuzz'); - const spy_company_bsAdjective = vi.spyOn(faker.company, 'bsAdjective'); - const spy_company_bsNoun = vi.spyOn(faker.company, 'bsNoun'); - - const bs = faker.company.bs(); - - expect(typeof bs).toBe('string'); - expect(spy_random_arrayElement).toHaveBeenCalledTimes(3); - expect(spy_company_bsBuzz).toHaveBeenCalledOnce(); - expect(spy_company_bsAdjective).toHaveBeenCalledOnce(); - expect(spy_company_bsNoun).toHaveBeenCalledOnce(); - - spy_random_arrayElement.mockRestore(); - spy_company_bsBuzz.mockRestore(); - spy_company_bsAdjective.mockRestore(); - spy_company_bsNoun.mockRestore(); - }); + // Create and log-back the seed for debug purposes + faker.seed(Math.ceil(Math.random() * 1_000_000_000)); + + describe(`random seeded tests for seed ${faker.seedValue}`, () => { + for (let i = 1; i <= NON_SEEDED_BASED_RUN; i++) { + describe('suffixes()', () => { + it('should return all suffixes', () => { + const actual = faker.company.suffixes(); + + expect(actual).toBeTruthy(); + expect(faker.definitions.company.suffix).toEqual(actual); + }); + }); + + describe('companyName()', () => { + it('should return a random company name', () => { + const actual = faker.company.companyName(); + + expect(actual).toBeTruthy(); + expect(typeof actual).toBe('string'); + }); + + it('should return a random company name with format 0', () => { + const actual = faker.company.companyName(0); + + expect(actual).toBeTruthy(); + expect(typeof actual).toBe('string'); + expect(actual).includes(' '); + }); + + it('should return a random company name with format 1', () => { + const actual = faker.company.companyName(1); + + expect(actual).toBeTruthy(); + expect(typeof actual).toBe('string'); + expect(actual).includes(' - '); + }); + + it('should return a random company name with format 2', () => { + const actual = faker.company.companyName(2); + + expect(actual).toBeTruthy(); + expect(typeof actual).toBe('string'); + expect(actual).includes(', '); + expect(actual).includes(' and '); + }); + }); + + describe('companySuffix()', () => { + it('should return random value from company.suffixes array', () => { + const actual = faker.company.companySuffix(); + + expect(actual).toBeTruthy(); + expect(typeof actual).toBe('string'); + expect(faker.definitions.company.suffix).toContain(actual); + }); + }); + + describe('catchPhrase()', () => { + it('should return phrase comprising of a catch phrase adjective, descriptor, and noun', () => { + const actual = faker.company.catchPhrase(); + + expect(actual).toBeTruthy(); + expect(typeof actual).toBe('string'); + + const parts = actual.split(' '); + + expect(parts.length).greaterThanOrEqual(3); + }); + }); + + describe('bs()', () => { + it('should return phrase comprising of a BS buzz, adjective, and noun', () => { + const actual = faker.company.bs(); + + expect(actual).toBeTruthy(); + expect(typeof actual).toBe('string'); + + const parts = actual.split(' '); + + expect(parts.length).greaterThanOrEqual(3); + }); + }); + + describe('catchPhraseAdjective()', () => { + it('should return random value from adjective array', () => { + const actual = faker.company.catchPhraseAdjective(); + + expect(actual).toBeTruthy(); + expect(typeof actual).toBe('string'); + expect(faker.definitions.company.adjective).toContain(actual); + }); + }); + + describe('catchPhraseDescriptor()', () => { + it('should return random value from descriptor array', () => { + const actual = faker.company.catchPhraseDescriptor(); + + expect(actual).toBeTruthy(); + expect(typeof actual).toBe('string'); + expect(faker.definitions.company.descriptor).toContain(actual); + }); + }); + + describe('catchPhraseNoun()', () => { + it('should return random value from noun array', () => { + const actual = faker.company.catchPhraseNoun(); + + expect(actual).toBeTruthy(); + expect(typeof actual).toBe('string'); + expect(faker.definitions.company.noun).toContain(actual); + }); + }); + + describe('bsAdjective()', () => { + it('should return random value from bs_adjective array', () => { + const actual = faker.company.bsAdjective(); + + expect(actual).toBeTruthy(); + expect(typeof actual).toBe('string'); + expect(faker.definitions.company.bs_adjective).toContain(actual); + }); + }); + + describe('bsBuzz()', () => { + it('should return random value from bs_verb array', () => { + const actual = faker.company.bsBuzz(); + + expect(actual).toBeTruthy(); + expect(typeof actual).toBe('string'); + expect(faker.definitions.company.bs_verb).toContain(actual); + }); + }); + + describe('bsNoun()', () => { + it('should return random value from bs_noun array', () => { + const actual = faker.company.bsNoun(); + + expect(actual).toBeTruthy(); + expect(typeof actual).toBe('string'); + expect(faker.definitions.company.bs_noun).toContain(actual); + }); + }); + } }); });