Skip to content

Commit

Permalink
Fix test for format three
Browse files Browse the repository at this point in the history
  • Loading branch information
michielbdejong committed Nov 24, 2023
1 parent 7027451 commit 40a2aff
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
10 changes: 10 additions & 0 deletions bookmarks/vanilla/src/modules/Bookmark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export interface IBookmark {
created?: string
updated?: string
creator?: string
topic?: string
}

export class Bookmark {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -234,5 +238,11 @@ export class Bookmark {
""
);
}
private static mapTopic(thing: ThingPersisted): string {
return (
getNamedNode(thing, BOOKMARK.hasTopic)?.value ??
""
);
}

}
7 changes: 3 additions & 4 deletions bookmarks/vanilla/test/unit/Bookmark.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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';
Expand All @@ -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'
}

Expand Down

0 comments on commit 40a2aff

Please sign in to comment.