diff --git a/bookmarks/vanilla/src/modules/Bookmark.ts b/bookmarks/vanilla/src/modules/Bookmark.ts index 3af798c..a111eb2 100644 --- a/bookmarks/vanilla/src/modules/Bookmark.ts +++ b/bookmarks/vanilla/src/modules/Bookmark.ts @@ -29,6 +29,7 @@ export interface IBookmark { created?: string updated?: string creator?: string + topic?: string } export class Bookmark { @@ -202,6 +203,9 @@ export class Bookmark { if (this.mapCreator(thing)) { obj.creator = this.mapCreator(thing); } + if (this.mapTopic(thing)) { + obj.topic = this.mapTopic(thing); + } return obj; } private static mapTitle(thing: ThingPersisted): string { @@ -234,5 +238,11 @@ export class Bookmark { "" ); } + private static mapTopic(thing: ThingPersisted): string { + return ( + getNamedNode(thing, BOOKMARK.hasTopic)?.value ?? + "" + ); + } } diff --git a/bookmarks/vanilla/test/unit/Bookmark.test.ts b/bookmarks/vanilla/test/unit/Bookmark.test.ts index 2f42360..1315530 100644 --- a/bookmarks/vanilla/test/unit/Bookmark.test.ts +++ b/bookmarks/vanilla/test/unit/Bookmark.test.ts @@ -196,8 +196,7 @@ describe("Bookmark", () => { expect(res).toEqual(expected); }); - // FIXME: https://github.com/solid-contrib/data-modules/issues/24 - it.only("should parse bookmarks in format two", async () => { + it("should parse bookmarks in format two", async () => { const indexUrl = "https://fake-pod.net/bookmarks/index.ttl"; const url = 'https://fake-pod.net/bookmarks/index.ttl#two'; @@ -231,7 +230,8 @@ describe("Bookmark", () => { expect(res).toEqual(expected); }); - it("should parse bookmarks in format three", async () => { + // FIXME: https://github.com/solid-contrib/data-modules/issues/24 + it.only("should parse bookmarks in format three", async () => { const indexUrl = "https://fake-pod.net/bookmarks/index.ttl"; const url = 'https://fake-pod.net/bookmarks/index.ttl#three'; @@ -240,7 +240,6 @@ describe("Bookmark", () => { url: 'https://fake-pod.net/bookmarks/index.ttl#three', title: 'three', link: 'http://example.com', - creator: 'https://michielbdejong.solidcommunity.net/profile/card#me', topic: 'http://wikipedia.org/sdfg' }