Skip to content

Commit e983222

Browse files
author
Gonzalo Diaz
committed
[REFACTOR] [Hacker Rank] Interview Preparation Kit: Arrays: Left Rotation. New JSON data typed.
1 parent ff81b52 commit e983222

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/hackerrank/interview_preparation_kit/arrays/ctci_array_left_rotation.test.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,25 @@ import arrayLeftRotation from './ctci_array_left_rotation';
55

66
import ROT_LEFT_TEST_CASES from './ctci_array_left_rotation.testcases.json';
77

8+
interface RotLeftTestCase {
9+
title: string;
10+
input: number[];
11+
d_rotations: number;
12+
expected: number[];
13+
}
14+
815
describe('ctci_array_left_rotation', () => {
916
it('rotLeft Test cases', () => {
1017
expect.assertions(8);
1118

12-
ROT_LEFT_TEST_CASES.forEach((test) => {
13-
const numbers = test.input;
14-
19+
ROT_LEFT_TEST_CASES.forEach((test: RotLeftTestCase) => {
1520
const answer = arrayLeftRotation.rotLeft(
16-
numbers,
21+
test.input,
1722
Number(test.d_rotations)
1823
);
1924

2025
console.debug(
21-
`rotLeft(${numbers.toString()}) solution found: ${test.expected.toString()}`
26+
`rotLeft(${test.input.toString()}) solution found: ${test.expected.toString()}`
2227
);
2328

2429
expect(answer).toStrictEqual(test.expected);

0 commit comments

Comments
 (0)