Skip to content

Commit

Permalink
fix tests for registerInTypeIndex
Browse files Browse the repository at this point in the history
  • Loading branch information
soltanireza65 committed Jan 9, 2024
1 parent d29f947 commit 18b0c40
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/unit/TypeIndexHelper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ describe("registerInTypeIndex", () => {
jest.spyOn(TypeIndexHelper, 'getTypeIndex').mockResolvedValueOnce(namedNode(privateTypeIndexPath));
jest.spyOn(inruptSOLIDClient, "getSolidDataset").mockResolvedValue(loadFixture("privateTypeIndexDS.json"));
jest.spyOn(inruptSOLIDClient, 'setThing').mockReturnValueOnce(loadFixture("privateTypeIndexDS.json"));
jest.spyOn(inruptSOLIDClient, 'saveSolidDatasetAt').mockResolvedValueOnce(loadFixture("createRegisteryDS.json"));
jest.spyOn(inruptSOLIDClient, 'saveSolidDatasetAt').mockResolvedValueOnce(loadFixture("privateTypeIndexDS.json"));

const res = await TypeIndexHelper.registerInTypeIndex(session.info.webId, "bookmarks", BOOKMARK.bookmarks, session.fetch, indexUrl, isContainer, isPrivate);
Expand All @@ -164,6 +165,7 @@ describe("registerInTypeIndex", () => {
jest.spyOn(TypeIndexHelper, 'getTypeIndex').mockResolvedValueOnce(namedNode(privateTypeIndexPath));
jest.spyOn(inruptSOLIDClient, "getSolidDataset").mockResolvedValue(loadFixture("publicTypeIndexDS.json"));
jest.spyOn(inruptSOLIDClient, 'setThing').mockReturnValueOnce(loadFixture("publicTypeIndexDS.json"));
jest.spyOn(inruptSOLIDClient, 'saveSolidDatasetAt').mockResolvedValueOnce(loadFixture("createRegisteryDS.json"));
jest.spyOn(inruptSOLIDClient, 'saveSolidDatasetAt').mockResolvedValueOnce(loadFixture("publicTypeIndexDS.json"));

const res = await TypeIndexHelper.registerInTypeIndex(session.info.webId, "bookmarks", BOOKMARK.bookmarks, session.fetch, indexUrl, isContainer, isPrivate);
Expand Down
16 changes: 16 additions & 0 deletions test/unit/fixtures/createRegisteryDS.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"type": "Dataset",
"graphs": {
"default": {}
},
"internal_changeLog": {
"additions": [],
"deletions": []
},
"internal_resourceInfo": {
"sourceIri": "https://fake-pod.net/bookmarks/",
"isRawData": false,
"contentType": "text/plain; charset=utf-8",
"linkedResources": {}
}
}

0 comments on commit 18b0c40

Please sign in to comment.