Files
outline/server/utils/removeIndexCollision.test.ts
Tom Moor bbe6df19ea Add locking to collection.move mutation
Add removeIndexCollision tests
2024-07-23 22:13:56 -04:00

17 lines
609 B
TypeScript

import { buildCollection } from "@server/test/factories";
import removeIndexCollision from "./removeIndexCollision";
describe("removeIndexCollision", () => {
it("should return the next available index", async () => {
const collection = await buildCollection({ index: "P" });
expect(
await removeIndexCollision(collection.teamId, collection.index!)
).toEqual("h");
});
it("should return existing index if no collision", async () => {
const collection = await buildCollection({ index: "%P" });
expect(await removeIndexCollision(collection.teamId, "n")).toEqual("n");
});
});