updeep-remeda/esm/util/splitPath.test.js

18 lines
583 B
JavaScript
Raw Normal View History

2023-01-03 18:51:35 +00:00
import { expect, it } from "vitest";
import splitPath from "./splitPath.js";
it("treats a number as a single step path", () => {
const path = 1;
const result = splitPath(path);
expect(result).to.deep.equal(["1"]);
});
it("handles arrays", () => {
const path = ["foo", "bar", "x"];
const result = splitPath(path);
expect(result).to.equal(path);
});
it("handles strings separated by dots", () => {
const path = "bar.0.y";
const result = splitPath(path);
expect(result).to.deep.equal(["bar", "0", "y"]);
});
//# sourceMappingURL=splitPath.test.js.map