Make nodes editable: norms, goals and keyword triggers
This commit is contained in:
committed by
Gerla, J. (Justin)
parent
f534f0cefa
commit
aeaf526797
22
test/utils/duplicateIndices.test.ts
Normal file
22
test/utils/duplicateIndices.test.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import duplicateIndices from "../../src/utils/duplicateIndices.ts";
|
||||
|
||||
describe("duplicateIndices (unit)", () => {
|
||||
it("returns an empty array for empty input", () => {
|
||||
expect(duplicateIndices<number>([])).toEqual([]);
|
||||
});
|
||||
|
||||
it("returns an empty array when no duplicates exist", () => {
|
||||
expect(duplicateIndices([1, 2, 3, 4])).toEqual([]);
|
||||
});
|
||||
|
||||
it("returns all positions for every duplicated value", () => {
|
||||
const result = duplicateIndices(["a", "b", "a", "c", "b", "b"]);
|
||||
expect(result.sort()).toEqual([0, 1, 2, 4, 5]);
|
||||
});
|
||||
|
||||
it("only treats identical references as duplicate objects", () => {
|
||||
const shared = { v: 1 };
|
||||
const result = duplicateIndices([shared, { v: 1 }, shared, shared]);
|
||||
expect(result.sort()).toEqual([0, 2, 3]);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user