Skip to content

Build your personal knowledge base with Trilium Notes

test(import): expect the typed email and phone labels the importers now write

Elian Doran63c78f0128e1
diff --git a/packages/trilium-core/src/services/import/anytype/importer.integration.spec.ts b/packages/trilium-core/src/services/import/anytype/importer.integration.spec.ts
index dd5a619aa5..79a0888eb4 100644
--- a/packages/trilium-core/src/services/import/anytype/importer.integration.spec.ts
+++ b/packages/trilium-core/src/services/import/anytype/importer.integration.spec.ts
@@ -712,15 +712,16 @@ describe("Anytype importer — integration", () => {
// Each visible column is a single-valued promoted definition, in the view's order.
expect(collection.getOwnedAttributes().filter((a) => a.name.startsWith("label:")).map((a) => a.name)).toEqual(["label:url", "label:email"]);
expect(collection.getOwnedLabelValue("label:url")).toBe("promoted,single,url,alias=URL");
- expect(collection.getOwnedLabelValue("label:email")).toBe("promoted,single,url,alias=Email");
+ expect(collection.getOwnedLabelValue("label:email")).toBe("promoted,single,email,alias=Email");
- // Members are the table rows, carrying their own values; email gets a clickable mailto: scheme.
+ // Members are the table rows, carrying their own values; an email is stored bare, which is what
+ // the typed input holds.
const rows = collection.getChildNotes();
expect(rows.map((n) => n.title).sort()).toEqual(["Untitled", "Untitled"]);
const byUrl = rows.find((n) => n.getOwnedLabelValue("url"));
const byEmail = rows.find((n) => n.getOwnedLabelValue("email"));
expect(byUrl?.getOwnedLabelValue("url")).toBe("https://triliumnotes.org");
- expect(byEmail?.getOwnedLabelValue("email")).toBe("mailto:[email protected]");
+ expect(byEmail?.getOwnedLabelValue("email")).toBe("[email protected]");
});
it("maps each Anytype view layout to the matching Trilium collection view type", async () => {
diff --git a/packages/trilium-core/src/services/import/notion/importer.integration.spec.ts b/packages/trilium-core/src/services/import/notion/importer.integration.spec.ts
index 7c667195b2..4fb321ada8 100644
--- a/packages/trilium-core/src/services/import/notion/importer.integration.spec.ts
+++ b/packages/trilium-core/src/services/import/notion/importer.integration.spec.ts
@@ -737,7 +737,7 @@ describe("Notion importer — integration", () => {
expect(row?.getOwnedLabelValue("lastEditedBy")).toBe("Elian Doran");
});
- it("imports url, email and phone columns as url-typed labels (mailto:/tel: schemes)", async () => {
+ it("imports url, email and phone columns as their own typed labels, holding the bare address", async () => {
const dbId = "388c5eca1b8b8078a20fd18330d81306";
const rowId = "388c5eca1b8b80929a78da7c68154bd7";
// All three render as <a class="url-value">; email/phone hrefs are bare addresses.
@@ -755,16 +755,17 @@ describe("Notion importer — integration", () => {
});
const db = importRoot.getChildNotes().find((n) => n.title === "DB");
- // Each column gets a url-typed definition.
+ // Each column gets a definition of the type its values are, rather than all three being urls.
expect(db?.getOwnedLabel("label:url")?.value).toBe("promoted,single,url,alias=URL");
- expect(db?.getOwnedLabel("label:email")?.value).toBe("promoted,single,url,alias=Email");
- expect(db?.getOwnedLabel("label:phone")?.value).toBe("promoted,single,url,alias=Phone");
+ expect(db?.getOwnedLabel("label:email")?.value).toBe("promoted,single,email,alias=Email");
+ expect(db?.getOwnedLabel("label:phone")?.value).toBe("promoted,single,phone,alias=Phone");
const row = db?.getChildNotes().find((n) => n.title === "Row");
expect(row?.getOwnedLabelValue("url")).toBe("https://triliumnotes.org");
- // Email/phone are stored as clickable mailto:/tel: links.
- expect(row?.getOwnedLabelValue("email")).toBe("mailto:[email protected]");
- expect(row?.getOwnedLabelValue("phone")).toBe("tel:12345678");
+ // Stored bare, which is what the typed email/phone inputs hold; the scheme is applied where the
+ // value is rendered as a link.
+ expect(row?.getOwnedLabelValue("email")).toBe("[email protected]");
+ expect(row?.getOwnedLabelValue("phone")).toBe("12345678");
});
it("imports a dated column with a clock time as a datetime label", async () => {