Skip to content

Commit 0ec8737

Browse files
authored
Addressing Rouven comment about bookmarking leak
1 parent 10266b6 commit 0ec8737

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

packages/core/test/bookmark-manager.test.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,28 @@ describe('BookmarkManager', () => {
6363
)
6464
})
6565

66+
it('should return not leak bookmarks from bookmarks supplier', async () => {
67+
const extraBookmarks = ['neo4j:bmextra', 'system:bmextra', 'adb:bmextra']
68+
const bookmarksSupplier = jest.fn()
69+
bookmarkManager.mockReturnValueOnce(Promise.resolve(extraBookmarks)).mockReturnValue(Promise.resolve([]))
70+
const manager = bookmarkManager({
71+
initialBookmarks: [...neo4jBookmarks, ...systemBookmarks],
72+
bookmarksSupplier
73+
})
74+
75+
const bookmarksWithExtraBookmarks = await manager.getBookmarks()
76+
77+
expect(bookmarksWithExtraBookmarks).toBeSortedEqual(
78+
[...neo4jBookmarks, ...systemBookmarks, ...extraBookmarks]
79+
)
80+
81+
const internalBookmarks = await manager.getBookmarks()
82+
83+
expect(bookmarksWithExtraBookmarks).toBeSortedEqual(
84+
[...neo4jBookmarks, ...systemBookmarks]
85+
)
86+
})
87+
6688
it('should return duplicate bookmarks if bookmarksSupplier returns already existing bm', async () => {
6789
const extraBookmarks = ['neo4j:bmextra', 'system:bmextra', 'adb:bmextra']
6890
const bookmarksSupplier = jest.fn(async () => await Promise.resolve([...extraBookmarks, ...systemBookmarks]))

0 commit comments

Comments
 (0)