Skip to content

Commit 59b161e

Browse files
committed
chore: fix linter errors
1 parent f034b8b commit 59b161e

36 files changed

+251
-120
lines changed

libs/cdk/tests/array/include.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ describe('[TEST]: include', () => {
88
expect([1, 2, 3].filter(include(4))).toEqual([]);
99
expect([1, 2, 3].filter(include([2, 3, 4]))).toEqual([2, 3]);
1010
expect([{v: 1}, {v: 2}, {v: 3}].filter(include({v: 1}))).toEqual([]);
11+
1112
const unique: PlainObject = {v: 1};
1213

1314
expect([unique, {v: 2}, {v: 3}].filter(include([unique]))).toEqual([unique]);

libs/cdk/tests/array/unique-array-of.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable sonarjs/no-hardcoded-ip */
12
import {uniqueArrayOf} from '@angular-ru/cdk/array';
23

34
describe('[TEST]: unique array of', () => {

libs/cdk/tests/array/unique.spec.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,56 +10,65 @@ describe('[TEST]: unique', () => {
1010
[],
1111
);
1212
});
13+
1314
it('should return one object', () => {
1415
expect(
1516
[a].filter((element, index, self) => unique(element, index, self)),
1617
).toEqual([a]);
1718
});
19+
1820
it('should return the same array', () => {
1921
expect(
2022
[a, b, c].filter((element, index, self) => unique(element, index, self)),
2123
).toEqual([a, b, c]);
2224
});
25+
2326
it('should return array with no duplicates of objects', () => {
2427
expect(
2528
[a, b, c, c, a].filter((element, index, self) =>
2629
unique(element, index, self),
2730
),
2831
).toEqual([a, b, c]);
2932
});
33+
3034
it('should return array with no duplicates of strings', () => {
3135
expect(
3236
['a', 'b', 'b', 'b'].filter((element, index, self) =>
3337
unique(element, index, self),
3438
),
3539
).toEqual(['a', 'b']);
3640
});
41+
3742
it('should return array with no duplicates of numbers', () => {
3843
expect(
3944
[13, 13, 13].filter((element, index, self) => unique(element, index, self)),
4045
).toEqual([13]);
4146
});
47+
4248
it('should return array with no duplicates according to values and types', () => {
4349
expect(
4450
[a, a, 'a', 13, 13, '13'].filter((element, index, self) =>
4551
unique(element, index, self),
4652
),
4753
).toEqual([a, 'a', 13, '13']);
4854
});
55+
4956
it('should return array with no duplicates of booleans', () => {
5057
expect(
5158
[true, true, false].filter((element, index, self) =>
5259
unique(element, index, self),
5360
),
5461
).toEqual([true, false]);
5562
});
63+
5664
it('should return array with no duplicates of "no value" types', () => {
5765
expect(
5866
[null, null, undefined, undefined, '', '', Infinity, Infinity].filter(
5967
(element, index, self) => unique(element, index, self),
6068
),
6169
).toEqual([null, undefined, '', Infinity]);
6270
});
71+
6372
it('should return empty array for the array of "NaN"', () => {
6473
expect(
6574
[NaN, NaN].filter((element, index, self) => unique(element, index, self)),

libs/cdk/tests/array/utility-arrays.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable sonarjs/no-undefined-argument */
12
import {
23
exclude,
34
hasAtMostOneItem,

libs/cdk/tests/big-decimal/add.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ describe('[TEST]: BigDecimal - add', () => {
4848
it('should: 126.7-13 = 113.7', () => {
4949
expect(BigDecimal.add('126.7', '-13')).toBe('113.7');
5050
});
51+
5152
it('should: 12.67-130.7 = -118.03', () => {
5253
expect(BigDecimal.add('12.67', '-130.7')).toBe('-118.03');
5354
});

libs/cdk/tests/big-decimal/big-decimal.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ describe('[TEST]: BigDecimal - main', () => {
273273
'0',
274274
);
275275
});
276+
276277
it('should: -0.0000005 * 13 = -0.0000065', () => {
277278
expect(
278279
new BigDecimal('-0.0000005').multiply(new BigDecimal('13')).getValue(),

libs/cdk/tests/big-decimal/compare-to.spec.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,23 @@ describe('[TEST]: BigDecimal - compareTo', () => {
4848
it('should: 126.7, -13 = 1', () => {
4949
expect(BigDecimal.compareTo('126.7', '-13')).toBe(1);
5050
});
51+
5152
it('should: 12.67, -12.67 = 1', () => {
5253
expect(BigDecimal.compareTo('12.67', '-12.67')).toBe(1);
5354
});
55+
5456
it('should: 12.67, 12.67 = 0', () => {
5557
expect(BigDecimal.compareTo('12.67', '12.67')).toBe(0);
5658
});
59+
5760
it('should: 12.67, 12.6700 = 0', () => {
5861
expect(BigDecimal.compareTo('12.67', '12.6700')).toBe(0);
5962
});
63+
6064
it('should: -12.67, -12.6700 = 0', () => {
6165
expect(BigDecimal.compareTo('-12.67', '-12.6700')).toBe(0);
6266
});
67+
6368
it('should: 0.67, .6700 = 0', () => {
6469
expect(BigDecimal.compareTo('0.67', '.6700')).toBe(0);
6570
});

libs/cdk/tests/big-decimal/multiply.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ describe('[TEST]: BigDecimal - multiply', () => {
6060
it('should: -12 * -0 = 0', () => {
6161
expect(BigDecimal.multiply('-12', '-0')).toBe('0');
6262
});
63+
6364
it('should: -0.0000005 * 13 = -0.0000065', () => {
6465
expect(BigDecimal.multiply('-0.0000005', '13')).toBe('-0.0000065');
6566
});

libs/cdk/tests/class-transformer/class-transformer.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ describe('[TEST]: Integration with class-transformer', () => {
129129
const actual: DemoDto = new DemoDto();
130130

131131
actual.numVal = 'INVALID NUMBER';
132+
132133
expect(actual.numVal).toBe('INVALID NUMBER');
133134
expect(plainToClass(DemoDto, actual).numVal).toBeNaN();
134135
});
@@ -137,6 +138,7 @@ describe('[TEST]: Integration with class-transformer', () => {
137138
const actual: DemoDto = new DemoDto();
138139

139140
actual.numVal = ' 100 ';
141+
140142
expect(actual.numVal).toBe(' 100 ');
141143
expect(plainToClass(DemoDto, actual).numVal).toBe(100);
142144
});

libs/cdk/tests/class-transformer/transform-to-boolean.spec.ts

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,28 @@ import {transformToBoolean} from '@angular-ru/cdk/class-transformer';
22
import {TransformFnParams} from 'class-transformer';
33

44
describe('[TEST] TransformToBoolean', () => {
5-
it('should return true', () => {
6-
const data: TransformFnParams[] = [
7-
{value: true} as TransformFnParams,
8-
{value: 'true'} as TransformFnParams,
9-
{value: '12312s'} as TransformFnParams,
10-
{value: '0'} as TransformFnParams,
11-
{value: '1'} as TransformFnParams,
12-
{value: {}} as TransformFnParams,
13-
{value: []} as TransformFnParams,
14-
{value: ''} as TransformFnParams,
15-
{value: ' '} as TransformFnParams,
16-
];
17-
18-
for (const item of data) {
19-
expect(transformToBoolean(item)).toBe(true);
20-
}
5+
it.each<TransformFnParams>([
6+
{value: true} as TransformFnParams,
7+
{value: 'true'} as TransformFnParams,
8+
{value: '12312s'} as TransformFnParams,
9+
{value: '0'} as TransformFnParams,
10+
{value: '1'} as TransformFnParams,
11+
{value: {}} as TransformFnParams,
12+
{value: []} as TransformFnParams,
13+
{value: ''} as TransformFnParams,
14+
{value: ' '} as TransformFnParams,
15+
])('should return true', (item: TransformFnParams) => {
16+
expect(transformToBoolean(item)).toBe(true);
2117
});
2218

23-
it('should return false', () => {
24-
const data: TransformFnParams[] = [
25-
{value: ' false '} as TransformFnParams,
26-
{value: 'false'} as TransformFnParams,
27-
{value: false} as TransformFnParams,
28-
{value: 0} as TransformFnParams,
29-
{value: null} as TransformFnParams,
30-
{value: undefined} as TransformFnParams,
31-
];
32-
33-
for (const item of data) {
34-
expect(transformToBoolean(item)).toBe(false);
35-
}
19+
it.each<TransformFnParams>([
20+
{value: ' false '} as TransformFnParams,
21+
{value: 'false'} as TransformFnParams,
22+
{value: false} as TransformFnParams,
23+
{value: 0} as TransformFnParams,
24+
{value: null} as TransformFnParams,
25+
{value: undefined} as TransformFnParams,
26+
])('should return false', (item: TransformFnParams) => {
27+
expect(transformToBoolean(item)).toBe(false);
3628
});
3729
});

0 commit comments

Comments
 (0)