mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
* fix parseApi not accepting versions that don't start with 'v' * add unit tests Signed-off-by: Sebastian Malton <smalton@mirantis.com> Co-authored-by: Sebastian Malton <smalton@mirantis.com>
31 lines
1.0 KiB
TypeScript
31 lines
1.0 KiB
TypeScript
import { split } from "../arrays";
|
|
|
|
describe("split array on element tests", () => {
|
|
test("empty array", () => {
|
|
expect(split([], 10)).toStrictEqual([[], [], false]);
|
|
});
|
|
|
|
test("one element, not in array", () => {
|
|
expect(split([1], 10)).toStrictEqual([[1], [], false]);
|
|
});
|
|
|
|
test("ten elements, not in array", () => {
|
|
expect(split([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 10)).toStrictEqual([[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [], false]);
|
|
});
|
|
|
|
test("one elements, in array", () => {
|
|
expect(split([1], 1)).toStrictEqual([[], [], true]);
|
|
});
|
|
|
|
test("ten elements, in front array", () => {
|
|
expect(split([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 0)).toStrictEqual([[], [1, 2, 3, 4, 5, 6, 7, 8, 9], true]);
|
|
});
|
|
|
|
test("ten elements, in middle array", () => {
|
|
expect(split([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 4)).toStrictEqual([[0, 1, 2, 3], [5, 6, 7, 8, 9], true]);
|
|
});
|
|
|
|
test("ten elements, in end array", () => {
|
|
expect(split([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 9)).toStrictEqual([[0, 1, 2, 3, 4, 5, 6, 7, 8], [], true]);
|
|
});
|
|
}); |