aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorShinigami <[email protected]>2023-04-18 17:26:59 +0200
committerGitHub <[email protected]>2023-04-18 17:26:59 +0200
commit5c3b6e032bdd0488c48b82c4395459be7ee50fb0 (patch)
tree951832789f14725642ebdb7be3f34a303660be48 /test
parentfc13424b4d43bcdae6e2f2a4ffcf2130bbc357f6 (diff)
downloadfaker-5c3b6e032bdd0488c48b82c4395459be7ee50fb0.tar.xz
faker-5c3b6e032bdd0488c48b82c4395459be7ee50fb0.zip
refactor(finance): rename account to accountNumber (#2054)
Diffstat (limited to 'test')
-rw-r--r--test/__snapshots__/finance.spec.ts.snap24
-rw-r--r--test/finance.spec.ts52
2 files changed, 62 insertions, 14 deletions
diff --git a/test/__snapshots__/finance.spec.ts.snap b/test/__snapshots__/finance.spec.ts.snap
index 217bc437..fe7a51b7 100644
--- a/test/__snapshots__/finance.spec.ts.snap
+++ b/test/__snapshots__/finance.spec.ts.snap
@@ -4,10 +4,14 @@ exports[`finance > 42 > account > noArgs 1`] = `"37917755"`;
exports[`finance > 42 > account > with length 1`] = `"3791775514"`;
-exports[`finance > 42 > account > with length option 1`] = `"3791775514"`;
-
exports[`finance > 42 > accountName 1`] = `"Money Market Account"`;
+exports[`finance > 42 > accountNumber > noArgs 1`] = `"37917755"`;
+
+exports[`finance > 42 > accountNumber > with length 1`] = `"3791775514"`;
+
+exports[`finance > 42 > accountNumber > with length option 1`] = `"3791775514"`;
+
exports[`finance > 42 > amount > noArgs 1`] = `"374.54"`;
exports[`finance > 42 > amount > with leagcy dec 1`] = `"374.54011"`;
@@ -104,10 +108,14 @@ exports[`finance > 1211 > account > noArgs 1`] = `"94872190"`;
exports[`finance > 1211 > account > with length 1`] = `"9487219061"`;
-exports[`finance > 1211 > account > with length option 1`] = `"9487219061"`;
-
exports[`finance > 1211 > accountName 1`] = `"Personal Loan Account"`;
+exports[`finance > 1211 > accountNumber > noArgs 1`] = `"94872190"`;
+
+exports[`finance > 1211 > accountNumber > with length 1`] = `"9487219061"`;
+
+exports[`finance > 1211 > accountNumber > with length option 1`] = `"9487219061"`;
+
exports[`finance > 1211 > amount > noArgs 1`] = `"928.52"`;
exports[`finance > 1211 > amount > with leagcy dec 1`] = `"928.52016"`;
@@ -204,10 +212,14 @@ exports[`finance > 1337 > account > noArgs 1`] = `"25122540"`;
exports[`finance > 1337 > account > with length 1`] = `"2512254032"`;
-exports[`finance > 1337 > account > with length option 1`] = `"2512254032"`;
-
exports[`finance > 1337 > accountName 1`] = `"Money Market Account"`;
+exports[`finance > 1337 > accountNumber > noArgs 1`] = `"25122540"`;
+
+exports[`finance > 1337 > accountNumber > with length 1`] = `"2512254032"`;
+
+exports[`finance > 1337 > accountNumber > with length option 1`] = `"2512254032"`;
+
exports[`finance > 1337 > amount > noArgs 1`] = `"262.02"`;
exports[`finance > 1337 > amount > with leagcy dec 1`] = `"262.02467"`;
diff --git a/test/finance.spec.ts b/test/finance.spec.ts
index 864ddb3b..5af487f8 100644
--- a/test/finance.spec.ts
+++ b/test/finance.spec.ts
@@ -27,6 +27,10 @@ describe('finance', () => {
);
t.describe('account', (t) => {
+ t.it('noArgs').it('with length', 10);
+ });
+
+ t.describe('accountNumber', (t) => {
t.it('noArgs')
.it('with length', 10)
.it('with length option', { length: 10 });
@@ -114,26 +118,58 @@ describe('finance', () => {
for (let i = 1; i <= NON_SEEDED_BASED_RUN; i++) {
describe('account()', () => {
it('should supply a default length', () => {
- const accountNum = faker.finance.account();
+ const accountNumber = faker.finance.account();
- expect(accountNum).toBeTruthy();
+ expect(accountNumber).toBeTruthy();
expect(
- accountNum,
+ accountNumber,
'The length of the account number should be 8 characters long'
).toHaveLength(8);
});
- it('should be the the length fo given number', () => {
- const accountNum = faker.finance.account(16);
+ it('should have same length as given length number', () => {
+ const accountNumber = faker.finance.account(16);
- expect(accountNum).toBeTruthy();
+ expect(accountNumber).toBeTruthy();
expect(
- accountNum,
- 'The length of the account number should match the given number'
+ accountNumber,
+ 'The length of the account number should match the given number'
).toHaveLength(16);
});
});
+ describe('accountNumber()', () => {
+ it('should supply a default length', () => {
+ const accountNumber = faker.finance.accountNumber();
+
+ expect(accountNumber).toBeTruthy();
+ expect(
+ accountNumber,
+ 'The length of the account number should be 8 characters long'
+ ).toHaveLength(8);
+ });
+
+ it('should have same length as given length number', () => {
+ const accountNumber = faker.finance.accountNumber(16);
+
+ expect(accountNumber).toBeTruthy();
+ expect(
+ accountNumber,
+ 'The length of the account number should match the given number'
+ ).toHaveLength(16);
+ });
+
+ it('should have same length as given length object', () => {
+ const accountNumber = faker.finance.accountNumber({ length: 12 });
+
+ expect(accountNumber).toBeTruthy();
+ expect(
+ accountNumber,
+ 'The length of the account number should match the given number'
+ ).toHaveLength(12);
+ });
+ });
+
describe('accountName()', () => {
it('should return a string', () => {
const accountName = faker.finance.accountName();