aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorShinigami <[email protected]>2022-01-30 19:37:21 +0100
committerGitHub <[email protected]>2022-01-30 19:37:21 +0100
commit6c5b9706eb16f8841d3f3b2109b8a21fb65fa04a (patch)
tree7b043e25d6fe971c3223851b2ccac8338e51d8a8 /test
parentd4125e2a7d69042c37ccecea89f1525c4424a45b (diff)
downloadfaker-6c5b9706eb16f8841d3f3b2109b8a21fb65fa04a.tar.xz
faker-6c5b9706eb16f8841d3f3b2109b8a21fb65fa04a.zip
chore: use recommended restrict-plus-operands (#369)
Diffstat (limited to 'test')
-rw-r--r--test/database.spec.ts14
-rw-r--r--test/finance.spec.ts52
-rw-r--r--test/finance_iban.spec.ts16
3 files changed, 25 insertions, 57 deletions
diff --git a/test/database.spec.ts b/test/database.spec.ts
index 7117e97b..3b4177e4 100644
--- a/test/database.spec.ts
+++ b/test/database.spec.ts
@@ -13,10 +13,7 @@ describe('database', () => {
expect(
column,
- 'The column name should be equals ' +
- expected +
- '. Current is ' +
- column
+ `The column name should be equals ${expected}. Current is ${column}`
).toBe(expected);
spy_database_column.mockRestore();
@@ -34,10 +31,7 @@ describe('database', () => {
expect(
collation,
- 'The collation should be equals ' +
- expected +
- '. Current is ' +
- collation
+ `The collation should be equals ${expected}. Current is ${collation}`
).toBe(expected);
spy_database_collation.mockRestore();
@@ -55,7 +49,7 @@ describe('database', () => {
expect(
engine,
- 'The db engine should be equals ' + expected + '. Current is ' + engine
+ `The db engine should be equals ${expected}. Current is ${engine}`
).toBe(expected);
spy_database_engine.mockRestore();
@@ -73,7 +67,7 @@ describe('database', () => {
expect(
type,
- 'The column type should be equals ' + expected + '. Current is ' + type
+ `The column type should be equals ${expected}. Current is ${type}`
).toBe(expected);
spy_database_type.mockRestore();
diff --git a/test/finance.spec.ts b/test/finance.spec.ts
index 724c225e..f49e90e3 100644
--- a/test/finance.spec.ts
+++ b/test/finance.spec.ts
@@ -15,10 +15,7 @@ describe('finance', () => {
expect(
actual,
- 'The expected default account length is ' +
- expected +
- ' but it was ' +
- actual
+ `The expected default account length is ${expected} but it was ${actual}`
).toBe(expected);
});
@@ -31,10 +28,7 @@ describe('finance', () => {
expect(
actual,
- 'The expected default account length is ' +
- expected +
- ' but it was ' +
- actual
+ `The expected default account length is ${expected} but it was ${actual}`
).toBe(expected);
});
@@ -47,10 +41,7 @@ describe('finance', () => {
expect(
actual,
- 'The expected default account length is ' +
- expected +
- ' but it was ' +
- actual
+ `The expected default account length is ${expected} but it was ${actual}`
).toBe(expected);
});
});
@@ -81,10 +72,7 @@ describe('finance', () => {
expect(
actual,
- 'The expected default mask length is ' +
- expected +
- ' but it was ' +
- actual
+ `The expected default mask length is ${expected} but it was ${actual}`
).toBe(expected);
});
@@ -102,10 +90,7 @@ describe('finance', () => {
expect(
actual,
- 'The expected default mask length is ' +
- expected +
- ' but it was ' +
- actual
+ `The expected default mask length is ${expected} but it was ${actual}`
).toBe(expected);
});
@@ -118,10 +103,7 @@ describe('finance', () => {
expect(
actual,
- 'The expected default mask length is ' +
- expected +
- ' but it was ' +
- actual
+ `The expected default mask length is ${expected} but it was ${actual}`
).toBe(expected);
});
@@ -135,10 +117,7 @@ describe('finance', () => {
expect(
actual,
- 'The expected match for parentheses is ' +
- expected +
- ' but it was ' +
- actual
+ `The expected match for parentheses is ${expected} but it was ${actual}`
).toBe(expected);
});
@@ -152,10 +131,7 @@ describe('finance', () => {
expect(
actual,
- 'The expected match for parentheses is ' +
- expected +
- ' but it was ' +
- actual
+ `The expected match for parentheses is ${expected} but it was ${actual}`
).toBe(expected);
});
@@ -387,9 +363,7 @@ describe('finance', () => {
const ibanLib = require('../dist/cjs/iban');
it('returns a random yet formally correct IBAN number', () => {
- const iban =
- // @ts-expect-error
- faker.finance.iban();
+ const iban: string = faker.finance.iban();
const bban = iban.substring(4) + iban.substring(0, 4);
expect(
@@ -398,7 +372,7 @@ describe('finance', () => {
).toStrictEqual(1);
});
it('returns a specific and formally correct IBAN number', () => {
- const iban = faker.finance.iban(false, 'DE');
+ const iban: string = faker.finance.iban(false, 'DE');
const bban = iban.substring(4) + iban.substring(0, 4);
const countryCode = iban.substring(0, 2);
@@ -421,9 +395,9 @@ describe('finance', () => {
it('returns a random yet formally correct BIC number', () => {
const bic = faker.finance.bic();
const expr = new RegExp(
- '^[A-Z]{4}(' +
- ibanLib.iso3166.join('|') +
- ')[A-Z2-9][A-NP-Z0-9]([A-Z0-9]{3})?$',
+ `^[A-Z]{4}(${ibanLib.iso3166.join(
+ '|'
+ )})[A-Z2-9][A-NP-Z0-9]([A-Z0-9]{3})?\$`,
'i'
);
diff --git a/test/finance_iban.spec.ts b/test/finance_iban.spec.ts
index 801ade34..d11a9568 100644
--- a/test/finance_iban.spec.ts
+++ b/test/finance_iban.spec.ts
@@ -5,7 +5,7 @@ import ibanLib from '../dist/cjs/iban';
console.log(ibanLib);
-function getAnIbanByCountry(countryCode) {
+function getAnIbanByCountry(countryCode: string): string {
let iban =
// @ts-expect-error
faker.finance.iban();
@@ -23,9 +23,9 @@ function getAnIbanByCountry(countryCode) {
console.log('Not found with 10000 seed, vraiment pas de bol');
} else if (countTry < maxTry) {
console.log(
- 'you can optimize this helper by add faker.seed(' +
- (100000 - 1 - countTry) +
- ') before the call of getAnIbanByCountry()'
+ `you can optimize this helper by add faker.seed(${
+ 100000 - 1 - countTry
+ }) before the call of getAnIbanByCountry()`
);
}
// console.log(iban);
@@ -53,7 +53,7 @@ describe('finance_iban.js', () => {
expect(
22,
- 'GE IBAN would be 22 chars length, given is ' + iban.length
+ `GE IBAN would be 22 chars length, given is ${iban.length}`
).toBe(iban.length);
expect(
@@ -112,7 +112,7 @@ describe('finance_iban.js', () => {
expect(
24,
- 'PK IBAN would be 24 chars length, given is ' + iban.length
+ `PK IBAN would be 24 chars length, given is ${iban.length}`
).toBe(iban.length);
expect(
@@ -178,7 +178,7 @@ describe('finance_iban.js', () => {
expect(
26,
- 'PK IBAN would be 26 chars length, given is ' + iban.length
+ `PK IBAN would be 26 chars length, given is ${iban.length}`
).toBe(iban.length);
expect(
@@ -251,7 +251,7 @@ describe('finance_iban.js', () => {
expect(
28,
- 'AZ IBAN would be 28 chars length, given is ' + iban.length
+ `AZ IBAN would be 28 chars length, given is ${iban.length}`
).toBe(iban.length);
expect(