Skip to content

Commit 08889bb

Browse files
committed
refactor (test): Refactoring tests to provide more readability
1 parent 0c1d113 commit 08889bb

20 files changed

+104
-105
lines changed

test/boolean/is-array.pipe.spec.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ describe('IsArrayPipe', () => {
88
});
99

1010
it('should return true for all inputs', () => {
11-
expect(pipe.transform([])).toEqual(true);
12-
expect(pipe.transform([1, 2])).toEqual(true);
13-
expect(pipe.transform([null])).toEqual(true);
11+
expect(pipe.transform([])).toBeTruthy();
12+
expect(pipe.transform([1, 2])).toBeTruthy();
13+
expect(pipe.transform([null])).toBeTruthy();
1414
});
1515

1616
it('should return false for all inputs', () => {
17-
expect(pipe.transform(null)).toEqual(false);
18-
expect(pipe.transform(undefined)).toEqual(false);
19-
expect(pipe.transform(1)).toEqual(false);
20-
expect(pipe.transform('')).toEqual(false);
21-
expect(pipe.transform({})).toEqual(false);
17+
expect(pipe.transform(null)).toBeFalsy();
18+
expect(pipe.transform(undefined)).toBeFalsy();
19+
expect(pipe.transform(1)).toBeFalsy();
20+
expect(pipe.transform('')).toBeFalsy();
21+
expect(pipe.transform({})).toBeFalsy();
2222
});
2323

2424
});

test/boolean/is-defined.pipe.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ describe('IsDefinedPipe', () => {
88
});
99

1010
it('should return true for all inputs', () => {
11-
expect(pipe.transform('')).toEqual(true);
12-
expect(pipe.transform(1)).toEqual(true);
13-
expect(pipe.transform({})).toEqual(true);
14-
expect(pipe.transform([])).toEqual(true);
11+
expect(pipe.transform('')).toBeTruthy();
12+
expect(pipe.transform(1)).toBeTruthy();
13+
expect(pipe.transform({})).toBeTruthy();
14+
expect(pipe.transform([])).toBeTruthy();
1515
});
1616

1717
it('should return false for all inputs', () => {
18-
expect(pipe.transform(undefined)).toEqual(false);
18+
expect(pipe.transform(undefined)).toBeFalsy();
1919
});
2020

2121
});

test/boolean/is-equal-to.pipe.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ describe('IsEqualToPipe', () => {
88
});
99

1010
it('should return true for all inputs', () => {
11-
expect(pipe.transform(1, 1)).toEqual(true);
12-
expect(pipe.transform(1, '1')).toEqual(true);
13-
expect(pipe.transform('1', '1')).toEqual(true);
11+
expect(pipe.transform(1, 1)).toBeTruthy();
12+
expect(pipe.transform(1, '1')).toBeTruthy();
13+
expect(pipe.transform('1', '1')).toBeTruthy();
1414
});
1515

1616
it('should return false for all inputs', () => {
17-
expect(pipe.transform(1, 2)).toEqual(false);
18-
expect(pipe.transform(1, '2')).toEqual(false);
19-
expect(pipe.transform('1', '2')).toEqual(false);
17+
expect(pipe.transform(1, 2)).toBeFalsy();
18+
expect(pipe.transform(1, '2')).toBeFalsy();
19+
expect(pipe.transform('1', '2')).toBeFalsy();
2020
});
2121

2222
});

test/boolean/is-function.pipe.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ describe('IsFunctionPipe', () => {
99

1010
it('should return true for all inputs', () => {
1111
const func: Function = () => {};
12-
expect(pipe.transform(func)).toEqual(true);
12+
expect(pipe.transform(func)).toBeTruthy();
1313
});
1414

1515
it('should return false for all inputs', () => {
16-
expect(pipe.transform(null)).toEqual(false);
17-
expect(pipe.transform(undefined)).toEqual(false);
18-
expect(pipe.transform(1)).toEqual(false);
19-
expect(pipe.transform('')).toEqual(false);
20-
expect(pipe.transform({})).toEqual(false);
16+
expect(pipe.transform(null)).toBeFalsy();
17+
expect(pipe.transform(undefined)).toBeFalsy();
18+
expect(pipe.transform(1)).toBeFalsy();
19+
expect(pipe.transform('')).toBeFalsy();
20+
expect(pipe.transform({})).toBeFalsy();
2121
});
2222

2323
});

test/boolean/is-greater-than-or-equal-to.pipe.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ describe('IsGreaterThanOrEqualToPipe', () => {
88
});
99

1010
it('should return true for all inputs', () => {
11-
expect(pipe.transform(1, 0)).toEqual(true);
12-
expect(pipe.transform(1, 1)).toEqual(true);
11+
expect(pipe.transform(1, 0)).toBeTruthy();
12+
expect(pipe.transform(1, 1)).toBeTruthy();
1313
});
1414

1515
it('should return false for all inputs', () => {
16-
expect(pipe.transform(0, 1)).toEqual(false);
16+
expect(pipe.transform(0, 1)).toBeFalsy();
1717
});
1818

1919
});

test/boolean/is-greater-than.pipe.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ describe('IsGreaterThanPipe', () => {
88
});
99

1010
it('should return true for all inputs', () => {
11-
expect(pipe.transform(1, 0)).toEqual(true);
11+
expect(pipe.transform(1, 0)).toBeTruthy();
1212
});
1313

1414
it('should return false for all inputs', () => {
15-
expect(pipe.transform(0, 1)).toEqual(false);
16-
expect(pipe.transform(1, 1)).toEqual(false);
15+
expect(pipe.transform(0, 1)).toBeFalsy();
16+
expect(pipe.transform(1, 1)).toBeFalsy();
1717
});
1818

1919
});

test/boolean/is-identical-to.pipe.spec.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ describe('IsIdenticalToPipe', () => {
88
});
99

1010
it('should return true for all inputs', () => {
11-
expect(pipe.transform(1, 1)).toEqual(true);
12-
expect(pipe.transform('1', '1')).toEqual(true);
13-
expect(pipe.transform([1, 2, 3], [1, 2, 3])).toEqual(true);
14-
expect(pipe.transform({'key': 2}, {'key': 2})).toEqual(true);
15-
expect(pipe.transform([{'key': 2}, {'key': 4}], [{'key': 2}, {'key': 4}])).toEqual(true);
11+
expect(pipe.transform(1, 1)).toBeTruthy();
12+
expect(pipe.transform('1', '1')).toBeTruthy();
13+
expect(pipe.transform([1, 2, 3], [1, 2, 3])).toBeTruthy();
14+
expect(pipe.transform({'key': 2}, {'key': 2})).toBeTruthy();
15+
expect(pipe.transform([{'key': 2}, {'key': 4}], [{'key': 2}, {'key': 4}])).toBeTruthy();
1616
});
1717

1818
it('should return false for all inputs', () => {
19-
expect(pipe.transform(1, 2)).toEqual(false);
20-
expect(pipe.transform('1', '2')).toEqual(false);
21-
expect(pipe.transform([1, 2, 3], [4, 2, 3])).toEqual(false);
22-
expect(pipe.transform({'key': 2}, {'key': 4})).toEqual(false);
23-
expect(pipe.transform([{'key': 4}, {'key': 2}], [{'key': 2}, {'key': 4}])).toEqual(false);
19+
expect(pipe.transform(1, 2)).toBeFalsy();
20+
expect(pipe.transform('1', '2')).toBeFalsy();
21+
expect(pipe.transform([1, 2, 3], [4, 2, 3])).toBeFalsy();
22+
expect(pipe.transform({'key': 2}, {'key': 4})).toBeFalsy();
23+
expect(pipe.transform([{'key': 4}, {'key': 2}], [{'key': 2}, {'key': 4}])).toBeFalsy();
2424
});
2525

2626
});

test/boolean/is-less-than-or-equal-to.pipe.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ describe('IsLessThanOrEqualToPipe', () => {
88
});
99

1010
it('should return true for all inputs', () => {
11-
expect(pipe.transform(0, 1)).toEqual(true);
12-
expect(pipe.transform(1, 1)).toEqual(true);
11+
expect(pipe.transform(0, 1)).toBeTruthy();
12+
expect(pipe.transform(1, 1)).toBeTruthy();
1313
});
1414

1515
it('should return false for all inputs', () => {
16-
expect(pipe.transform(1, 0)).toEqual(false);
16+
expect(pipe.transform(1, 0)).toBeFalsy();
1717
});
1818

1919
});

test/boolean/is-less-than.pipe.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ describe('IsLessThanPipe', () => {
88
});
99

1010
it('should return true for all inputs', () => {
11-
expect(pipe.transform(0, 1)).toEqual(true);
11+
expect(pipe.transform(0, 1)).toBeTruthy();
1212
});
1313

1414
it('should return false for all inputs', () => {
15-
expect(pipe.transform(1, 0)).toEqual(false);
16-
expect(pipe.transform(1, 1)).toEqual(false);
15+
expect(pipe.transform(1, 0)).toBeFalsy();
16+
expect(pipe.transform(1, 1)).toBeFalsy();
1717
});
1818

1919
});

test/boolean/is-not-equal-to.pipe.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ describe('IsNotEqualToPipe', () => {
88
});
99

1010
it('should return true for all inputs', () => {
11-
expect(pipe.transform(1, 2)).toEqual(true);
12-
expect(pipe.transform(1, '2')).toEqual(true);
13-
expect(pipe.transform('1', '2')).toEqual(true);
11+
expect(pipe.transform(1, 2)).toBeTruthy();
12+
expect(pipe.transform(1, '2')).toBeTruthy();
13+
expect(pipe.transform('1', '2')).toBeTruthy();
1414
});
1515

1616
it('should return false for all inputs', () => {
17-
expect(pipe.transform(1, 1)).toEqual(false);
18-
expect(pipe.transform(1, '1')).toEqual(false);
19-
expect(pipe.transform('1', '1')).toEqual(false);
17+
expect(pipe.transform(1, 1)).toBeFalsy();
18+
expect(pipe.transform(1, '1')).toBeFalsy();
19+
expect(pipe.transform('1', '1')).toBeFalsy();
2020
});
2121

2222
});

0 commit comments

Comments
 (0)