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(finance): use fake patterns in transactionDescription #3202

Draft
wants to merge 10 commits into
base: next
Choose a base branch
from
10 changes: 10 additions & 0 deletions src/modules/finance/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { FakerError } from '../../errors/faker-error';
import { deprecated } from '../../internal/deprecated';
import { ModuleBase } from '../../internal/module-base';
import type { BitcoinAddressFamilyType, BitcoinNetworkType } from './bitcoin';
import {
Expand Down Expand Up @@ -955,8 +956,17 @@ export class FinanceModule extends ModuleBase {
* // 'invoice transaction at Kilback - Durgan using card ending with ***(...4316) for UAH 783.82 in account ***16168663'
*
* @since 5.1.0
*
* @deprecated Refer to [PR #3202](https://github.com/faker-js/faker/pull/3202#issuecomment-2425147798) for alternatives ways to generate a transaction descriptions.
*/
transactionDescription(): string {
deprecated({
deprecated: 'faker.finance.transactionDescription()',
proposed: 'an alternative from PR #3202',
since: '9.1.0',
ST-DDT marked this conversation as resolved.
Show resolved Hide resolved
until: '10.0.0',
});

const amount = this.amount();
const company = this.faker.company.name();
const transactionType = this.transactionType();
Expand Down
1 change: 1 addition & 0 deletions test/modules/finance.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,7 @@ describe('finance', () => {

describe('transactionDescription()', () => {
it('should return a string', () => {
// eslint-disable-next-line @typescript-eslint/no-deprecated
const transactionDescription = faker.finance.transactionDescription();

expect(transactionDescription).toBeTypeOf('string');
Expand Down