mirror of
https://github.com/outline/outline.git
synced 2026-11-20 21:23:06 +03:00
Slugs are now generated only on the server, which lazily loads pinyin-pro. The client reads the path from the API rather than computing it.
43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
import stores from "~/stores";
|
|
|
|
describe("Collection model", () => {
|
|
it("should initialize with data", () => {
|
|
const collection = stores.collections.add({
|
|
id: "123",
|
|
name: "Engineering",
|
|
});
|
|
expect(collection.name).toBe("Engineering");
|
|
});
|
|
|
|
it("should show the translated name for a personal collection", () => {
|
|
const collection = stores.collections.add({
|
|
id: "456",
|
|
name: "Renamed",
|
|
ownerId: "user-id",
|
|
});
|
|
expect(collection.displayName).toBe("Personal");
|
|
|
|
const shared = stores.collections.add({ id: "789", name: "Design" });
|
|
expect(shared.displayName).toBe("Design");
|
|
});
|
|
|
|
it("should not add a document that is already in the collection", () => {
|
|
const collection = stores.collections.add({
|
|
id: "abc",
|
|
name: "Personal",
|
|
sort: { field: "title", direction: "asc" },
|
|
documents: [],
|
|
});
|
|
const document = stores.documents.add({
|
|
id: "doc-1",
|
|
title: "Doc",
|
|
path: "/doc/doc-1",
|
|
collectionId: collection.id,
|
|
});
|
|
|
|
collection.addDocument(document);
|
|
collection.addDocument(document);
|
|
expect(collection.documents?.map((node) => node.id)).toEqual(["doc-1"]);
|
|
});
|
|
});
|