Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(company)!: remove v8 deprecated company methods #2726

Merged
merged 4 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions docs/guide/upgrading_v9/2726.md
xDivisionByZerox marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
### Remove deprecated company methods

Removed deprecated company methods

| old | replacement |
| ----------------------------- | ----------------------------- |
| `faker.company.suffixes` | Part of `faker.company.name` |
| `faker.company.companySuffix` | Part of `faker.company.name` |
| `faker.company.bs` | `faker.company.buzzPhrase` |
| `faker.company.bsAdjective` | `faker.company.buzzAdjective` |
| `faker.company.bsBuzz` | `faker.company.buzzVerb` |
| `faker.company.bsNoun` | `faker.company.buzzNoun` |
7 changes: 0 additions & 7 deletions src/definitions/company.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,4 @@ export type CompanyDefinition = LocaleEntry<{
* Catchphrase nouns that can be displayed to an end user.
*/
noun: string[];

/**
* Company/Business entity types.
*
* @deprecated Use `faker.company.name` instead.
*/
suffix: string[];
xDivisionByZerox marked this conversation as resolved.
Show resolved Hide resolved
}>;
130 changes: 0 additions & 130 deletions src/modules/company/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { deprecated } from '../../internal/deprecated';
import { ModuleBase } from '../../internal/module-base';

/**
Expand All @@ -16,30 +15,6 @@ import { ModuleBase } from '../../internal/module-base';
* - For finance-related entries, use [`faker.finance`](https://fakerjs.dev/api/finance.html).
*/
export class CompanyModule extends ModuleBase {
/**
* Returns an array with possible company name suffixes.
*
* @see faker.company.name(): For generating a complete company name.
*
* @example
* faker.company.suffixes() // [ 'Inc', 'and Sons', 'LLC', 'Group' ]
*
* @since 2.0.1
*
* @deprecated Use `faker.company.name` instead.
*/
suffixes(): string[] {
deprecated({
deprecated: 'faker.company.suffixes',
proposed: 'faker.company.name',
since: '8.0',
until: '9.0',
});
// Don't want the source array exposed to modification, so return a copy
// eslint-disable-next-line deprecation/deprecation
return [...this.faker.definitions.company.suffix];
}

/**
* Generates a random company name.
*
Expand All @@ -52,31 +27,6 @@ export class CompanyModule extends ModuleBase {
return this.faker.helpers.fake(this.faker.definitions.company.name_pattern);
}

/**
* Returns a random company suffix.
*
* @see faker.company.name(): For generating a complete company name.
*
* @example
* faker.company.companySuffix() // 'and Sons'
*
* @since 2.0.1
*
* @deprecated Use `faker.company.name` instead.
*/
companySuffix(): string {
deprecated({
deprecated: 'faker.company.companySuffix',
proposed: 'faker.company.name',
since: '8.0',
until: '9.0',
});
return this.faker.helpers.arrayElement(
// eslint-disable-next-line deprecation/deprecation
this.suffixes()
);
}

/**
* Generates a random catch phrase that can be displayed to an end user.
*
Expand All @@ -93,26 +43,6 @@ export class CompanyModule extends ModuleBase {
].join(' ');
}

/**
* Generates a random company bs phrase.
*
* @example
* faker.company.bs() // 'cultivate synergistic e-markets'
*
* @since 2.0.1
*
* @deprecated Use `faker.company.buzzPhrase` instead.
*/
bs(): string {
deprecated({
deprecated: 'faker.company.bs',
proposed: 'faker.company.buzzPhrase',
since: '8.0',
until: '9.0',
});
return this.buzzPhrase();
}

/**
* Generates a random buzz phrase that can be used to demonstrate data being viewed by a manager.
*
Expand Down Expand Up @@ -165,26 +95,6 @@ export class CompanyModule extends ModuleBase {
return this.faker.helpers.arrayElement(this.faker.definitions.company.noun);
}

/**
* Returns a random company bs adjective.
*
* @example
* faker.company.bsAdjective() // 'one-to-one'
*
* @since 2.0.1
*
* @deprecated Use `faker.company.buzzAdjective` instead.
*/
bsAdjective(): string {
deprecated({
deprecated: 'faker.company.bsAdjective',
proposed: 'faker.company.buzzAdjective',
since: '8.0',
until: '9.0',
});
return this.buzzAdjective();
}

/**
* Returns a random buzz adjective that can be used to demonstrate data being viewed by a manager.
*
Expand All @@ -199,26 +109,6 @@ export class CompanyModule extends ModuleBase {
);
}

/**
* Returns a random company bs buzz word.
*
* @example
* faker.company.bsBuzz() // 'empower'
*
* @since 2.0.1
*
* @deprecated Use `faker.company.buzzVerb` instead.
*/
bsBuzz(): string {
deprecated({
deprecated: 'faker.company.bsBuzz',
proposed: 'faker.company.buzzVerb',
since: '8.0',
until: '9.0',
});
return this.buzzVerb();
}

/**
* Returns a random buzz verb that can be used to demonstrate data being viewed by a manager.
*
Expand All @@ -233,26 +123,6 @@ export class CompanyModule extends ModuleBase {
);
}

/**
* Returns a random company bs noun.
*
* @example
* faker.company.bsNoun() // 'paradigms'
*
* @since 2.0.1
*
* @deprecated Use `faker.company.buzzNoun` instead.
*/
bsNoun(): string {
deprecated({
deprecated: 'faker.company.bsNoun',
proposed: 'faker.company.buzzNoun',
since: '8.0',
until: '9.0',
});
return this.buzzNoun();
}

/**
* Returns a random buzz noun that can be used to demonstrate data being viewed by a manager.
*
Expand Down
4 changes: 0 additions & 4 deletions test/all-functional.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@ type SkipConfig<TModule> = Partial<

const BROKEN_LOCALE_METHODS = {
// TODO @ST-DDT 2022-03-28: these are TODOs (usually broken locale files)
company: {
suffixes: ['az'],
companySuffix: ['az'],
},
date: {
between: '*',
betweens: '*',
Expand Down
33 changes: 0 additions & 33 deletions test/modules/__snapshots__/company.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,8 @@ exports[`company > 42 > catchPhraseDescriptor 1`] = `"explicit"`;

exports[`company > 42 > catchPhraseNoun 1`] = `"framework"`;

exports[`company > 42 > companySuffix 1`] = `"and Sons"`;

exports[`company > 42 > name 1`] = `"Wiegand - Reynolds"`;

exports[`company > 42 > suffixes 1`] = `
[
"Inc",
"and Sons",
"LLC",
"Group",
]
`;

exports[`company > 1211 > buzzAdjective 1`] = `"plug-and-play"`;

exports[`company > 1211 > buzzNoun 1`] = `"methodologies"`;
Expand All @@ -45,19 +34,8 @@ exports[`company > 1211 > catchPhraseDescriptor 1`] = `"upward-trending"`;

exports[`company > 1211 > catchPhraseNoun 1`] = `"system engine"`;

exports[`company > 1211 > companySuffix 1`] = `"Group"`;

exports[`company > 1211 > name 1`] = `"Trantow, Fahey and Zieme"`;

exports[`company > 1211 > suffixes 1`] = `
[
"Inc",
"and Sons",
"LLC",
"Group",
]
`;

exports[`company > 1337 > buzzAdjective 1`] = `"global"`;

exports[`company > 1337 > buzzNoun 1`] = `"ROI"`;
Expand All @@ -74,15 +52,4 @@ exports[`company > 1337 > catchPhraseDescriptor 1`] = `"demand-driven"`;

exports[`company > 1337 > catchPhraseNoun 1`] = `"data-warehouse"`;

exports[`company > 1337 > companySuffix 1`] = `"and Sons"`;

exports[`company > 1337 > name 1`] = `"Cronin and Sons"`;

exports[`company > 1337 > suffixes 1`] = `
[
"Inc",
"and Sons",
"LLC",
"Group",
]
`;
23 changes: 0 additions & 23 deletions test/modules/company.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ const NON_SEEDED_BASED_RUN = 5;
describe('company', () => {
seededTests(faker, 'company', (t) => {
t.itEach(
'suffixes',
'name',
'companySuffix',
'catchPhrase',
'buzzPhrase',
'catchPhraseAdjective',
Expand All @@ -20,22 +18,11 @@ describe('company', () => {
'buzzVerb',
'buzzNoun'
);

t.skip('bs').skip('bsAdjective').skip('bsBuzz').skip('bsNoun');
});

describe.each(times(NON_SEEDED_BASED_RUN).map(() => faker.seed()))(
'random seeded tests for seed %i',
() => {
describe('suffixes()', () => {
it('should return all suffixes', () => {
const actual = faker.company.suffixes();

expect(actual).toBeTruthy();
expect(faker.definitions.company.suffix).toEqual(actual);
});
});

describe('name()', () => {
it('should return a random company name', () => {
const actual = faker.company.name();
Expand All @@ -45,16 +32,6 @@ describe('company', () => {
});
});

describe('companySuffix()', () => {
it('should return random value from company.suffixes array', () => {
const actual = faker.company.companySuffix();

expect(actual).toBeTruthy();
expect(actual).toBeTypeOf('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();
Expand Down