import assert from "node:assert"; import { describe, it } from "node:test"; import { getLinesProp } from "./index"; describe("getLinesProp", () => { it("should return the same number when source is a number", () => { assert.strictEqual(getLinesProp(100, 0), 100); assert.strictEqual(getLinesProp(100, 1), 100); assert.strictEqual(getLinesProp(100, 5), 100); }); it("should return array element by index when source is an array", () => { const array = [ 100, 200, 300, 400 ]; assert.strictEqual(getLinesProp(array, 0), 100); assert.strictEqual(getLinesProp(array, 1), 200); assert.strictEqual(getLinesProp(array, 2), 300); assert.strictEqual(getLinesProp(array, 3), 400); }); it("should handle empty array (returns undefined)", () => { assert.strictEqual(getLinesProp([], 0), undefined); assert.strictEqual(getLinesProp([], 5), undefined); }); it("should work with decimal numbers", () => { assert.strictEqual(getLinesProp(12.5, 0), 12.5); assert.strictEqual(getLinesProp([ 12.5, 15.75 ], 1), 15.75); }); });