Skip to content

Commit 636462a

Browse files
author
Gonzalo Diaz
committed
Eslint upgrade fixes
1 parent 78be983 commit 636462a

7 files changed

Lines changed: 30 additions & 28 deletions

src/hackerrank/interview_preparation_kit/search/ctci_ice_cream_parlor.test.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import TEST_CASES_BORDER_CASES from './ctci_ice_cream_parlor.border_testcases.js
77

88
describe('ctci_ice_cream_parlor', () => {
99
it('whatFlavorsCompute test cases', () => {
10-
expect.assertions(12);
10+
expect.assertions(7);
1111

1212
let totalTestsCount = 0;
1313

@@ -20,7 +20,8 @@ describe('ctci_ice_cream_parlor', () => {
2020
);
2121

2222
expect(answer).toStrictEqual(test.expected);
23-
expect(whatFlavors(test.costs, test.money)).toBeUndefined();
23+
24+
whatFlavors(test.costs, test.money);
2425

2526
totalTestsCount += 1;
2627
}
@@ -31,7 +32,7 @@ describe('ctci_ice_cream_parlor', () => {
3132
});
3233

3334
it('whatFlavors border test cases', () => {
34-
expect.assertions(4);
35+
expect.assertions(3);
3536

3637
let totalTestsCount = 0;
3738

@@ -40,7 +41,8 @@ describe('ctci_ice_cream_parlor', () => {
4041
expect(whatFlavorsCompute(test.costs, test.money)).toStrictEqual(
4142
test.expected
4243
);
43-
expect(whatFlavors(test.costs, test.money)).toBeUndefined();
44+
45+
whatFlavors(test.costs, test.money);
4446

4547
totalTestsCount += 1;
4648
}
@@ -56,6 +58,6 @@ describe('ctci_ice_cream_parlor', () => {
5658
const cost: number[] = [];
5759
const money = 100;
5860

59-
expect(whatFlavors(cost, money)).toBeUndefined();
61+
expect(() => whatFlavors(cost, money)).not.toThrow();
6062
});
6163
});

src/hackerrank/interview_preparation_kit/search/ctci_ice_cream_parlor_bruteforce.test.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import TEST_CASES_BORDER_CASES from './ctci_ice_cream_parlor.border_testcases.js
1010

1111
describe('ctci_ice_cream_parlor_bruteforce', () => {
1212
it('whatFlavors test cases', () => {
13-
expect.assertions(12);
13+
expect.assertions(7);
1414

1515
let totalTestsCount = 0;
1616

@@ -23,7 +23,8 @@ describe('ctci_ice_cream_parlor_bruteforce', () => {
2323
);
2424

2525
expect(answer).toStrictEqual(test.expected);
26-
expect(whatFlavors(test.costs, test.money)).toBeUndefined();
26+
27+
whatFlavors(test.costs, test.money);
2728

2829
totalTestsCount += 1;
2930
}
@@ -34,7 +35,7 @@ describe('ctci_ice_cream_parlor_bruteforce', () => {
3435
});
3536

3637
it('whatFlavors border test cases', () => {
37-
expect.assertions(4);
38+
expect.assertions(3);
3839

3940
let totalTestsCount = 0;
4041

@@ -43,7 +44,8 @@ describe('ctci_ice_cream_parlor_bruteforce', () => {
4344
expect(
4445
whatFlavorsBruteforceCompute(test.costs, test.money)
4546
).toStrictEqual(test.expected);
46-
expect(whatFlavors(test.costs, test.money)).toBeUndefined();
47+
48+
whatFlavors(test.costs, test.money);
4749

4850
totalTestsCount += 1;
4951
}
@@ -59,6 +61,6 @@ describe('ctci_ice_cream_parlor_bruteforce', () => {
5961
const cost: number[] = [];
6062
const money = 100;
6163

62-
expect(whatFlavors(cost, money)).toBeUndefined();
64+
expect(() => whatFlavors(cost, money)).not.toThrow();
6365
});
6466
});

src/hackerrank/interview_preparation_kit/search/ctci_ice_cream_parlor_optimized.test.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import TEST_CASES_BORDER_CASES from './ctci_ice_cream_parlor.border_testcases.js
1010

1111
describe('ctci_ice_cream_parlor_optimized', () => {
1212
it('whatFlavorsCompute test cases', () => {
13-
expect.assertions(12);
13+
expect.assertions(7);
1414

1515
let totalTestsCount = 0;
1616

@@ -23,7 +23,8 @@ describe('ctci_ice_cream_parlor_optimized', () => {
2323
);
2424

2525
expect(answer).toStrictEqual(test.expected);
26-
expect(whatFlavors(test.costs, test.money)).toBeUndefined();
26+
27+
whatFlavors(test.costs, test.money);
2728

2829
totalTestsCount += 1;
2930
}
@@ -34,7 +35,7 @@ describe('ctci_ice_cream_parlor_optimized', () => {
3435
});
3536

3637
it('whatFlavors border test cases', () => {
37-
expect.assertions(4);
38+
expect.assertions(3);
3839

3940
let totalTestsCount = 0;
4041

@@ -43,7 +44,8 @@ describe('ctci_ice_cream_parlor_optimized', () => {
4344
expect(whatFlavorsCompute(test.costs, test.money)).toStrictEqual(
4445
test.expected
4546
);
46-
expect(whatFlavors(test.costs, test.money)).toBeUndefined();
47+
48+
whatFlavors(test.costs, test.money);
4749

4850
totalTestsCount += 1;
4951
}
@@ -59,6 +61,6 @@ describe('ctci_ice_cream_parlor_optimized', () => {
5961
const cost: number[] = [];
6062
const money = 100;
6163

62-
expect(whatFlavors(cost, money)).toBeUndefined();
64+
expect(() => whatFlavors(cost, money)).not.toThrow();
6365
});
6466
});

src/hackerrank/interview_preparation_kit/search/swap_nodes_algo.test.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,31 @@
11
import { describe, expect, it } from '@jest/globals';
22

3-
import { Node } from '../../lib/Node';
43
import { Tree, swapNodes, __INITIAL_LEVEL__ } from './swap_nodes_algo';
54
import TEST_CASES from './swap_nodes_algo.testcases.json';
65

76
describe('swap_nodes_algo', () => {
87
it('test_buildTree_empty', () => {
9-
expect.assertions(4);
8+
expect.assertions(2);
109

1110
const input: number[][] = [];
1211
const tree: Tree = new Tree(input);
1312
const expected: number[] = [1];
1413

1514
expect(tree.flatTree()).toStrictEqual(expected);
16-
expect(tree.getRoot()).not.toBeNull();
17-
expect(tree.getRoot()).toBeInstanceOf(Node);
15+
1816
expect(tree.getRoot().data).toBe(__INITIAL_LEVEL__);
1917
});
2018

2119
it('test_build_malformed_tree', () => {
22-
expect.assertions(4);
20+
expect.assertions(2);
2321

2422
const input: number[][] = [[], []];
2523
const tree: Tree = new Tree(input);
2624
const tresult: number[] = tree.flatTree();
2725
const expected: number[] = [__INITIAL_LEVEL__];
2826

2927
expect(tresult).toStrictEqual(expected);
30-
expect(tree.getRoot()).not.toBeNull();
31-
expect(tree.getRoot()).toBeInstanceOf(Node);
28+
3229
expect(tree.getRoot().data).toBe(__INITIAL_LEVEL__);
3330
});
3431

src/hackerrank/interview_preparation_kit/sort/ctci_bubble_sort.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@ import TEST_CASES from './ctci_bubble_sort.testcases.json';
55

66
describe('countSwaps', () => {
77
it('build tree and flattened tree test cases', () => {
8-
expect.assertions(7);
8+
expect.assertions(4);
99

1010
for (const test of TEST_CASES) {
1111
const sortable = new SortableGroup(test.input);
1212
const resultSort = sortable.bubble_sort().group;
13-
const resultPrint = countSwaps(test.input);
13+
countSwaps(test.input);
1414

15-
expect(resultPrint).toBeUndefined();
1615
expect(resultSort).toStrictEqual(test.sorted);
1716
}
1817

src/hackerrank/interview_preparation_kit/sort/ctci_comparator_sorting.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ describe('comparatorSorting', () => {
2424
});
2525

2626
it('test_comparator_sorting', () => {
27-
expect.assertions(9);
27+
expect.assertions(5);
2828

2929
for (const test of TEST_CASES) {
3030
const players: SortablePlayer[] = [];
@@ -34,7 +34,8 @@ describe('comparatorSorting', () => {
3434
}
3535

3636
expect(comparatorSorting(players)).toStrictEqual(test.sorted);
37-
expect(comparatorSortingPrint(players)).toBeUndefined();
37+
38+
comparatorSortingPrint(players);
3839
}
3940

4041
expect(TEST_CASES).toHaveLength(4);

src/logger.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable jest/require-hook */
21
/* istanbul ignore file */
32

43
import pino from 'pino';

0 commit comments

Comments
 (0)