@seasketch/geoprocessing
Version:
Geoprocessing and reporting framework for SeaSketch 2.0
16 lines • 484 B
JavaScript
import { describe, test, expect } from "vitest";
import { keyBy } from "./keyBy.js";
const list = [
{ name: "foo", id: 1 },
{ name: "blue", id: 2 },
{ name: "foo", id: 3 },
];
describe("keyBy", () => {
test("keyBy", async () => {
const result = keyBy(list, (item) => item.name);
expect(Object.keys(result).length).toBe(2);
expect(result.blue.id).toBe(2);
expect(result.foo.id).toBe(3);
});
});
//# sourceMappingURL=keyBy.test.js.map