diff --git a/.prettierrc.toml b/.prettierrc.toml index 67a092c..48fbb86 100644 --- a/.prettierrc.toml +++ b/.prettierrc.toml @@ -1,3 +1,4 @@ +plugins = ["prettier-plugin-svelte"] bracketSameLine = true singleQuote = true svelteAllowShorthand = true diff --git a/package-lock.json b/package-lock.json index 01acc89..9783ddf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -45,8 +45,8 @@ "normalize.css": "^8.0.1", "postcss": "^8.4.26", "postcss-url": "^10.1.3", - "prettier": "^2.8.4", - "prettier-plugin-svelte": "^2.9.0", + "prettier": "3.0.0", + "prettier-plugin-svelte": "^3.0.0", "rollup-plugin-copy": "^3.4.0", "sass": "^1.63.6", "smui-theme": "^6.2.0", @@ -8150,28 +8150,28 @@ } }, "node_modules/prettier": { - "version": "2.8.4", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.4.tgz", - "integrity": "sha512-vIS4Rlc2FNh0BySk3Wkd6xmwxB0FpOndW5fisM5H8hsZSxU2VWVB5CWIkIjWvrHjIhxk2g3bfMKM87zNTrZddw==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.0.tgz", + "integrity": "sha512-zBf5eHpwHOGPC47h0zrPyNn+eAEIdEzfywMoYn2XPi0P44Zp0tSq64rq0xAREh4auw2cJZHo9QUob+NqCQky4g==", "dev": true, "bin": { - "prettier": "bin-prettier.js" + "prettier": "bin/prettier.cjs" }, "engines": { - "node": ">=10.13.0" + "node": ">=14" }, "funding": { "url": "https://github.com/prettier/prettier?sponsor=1" } }, "node_modules/prettier-plugin-svelte": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/prettier-plugin-svelte/-/prettier-plugin-svelte-2.9.0.tgz", - "integrity": "sha512-3doBi5NO4IVgaNPtwewvrgPpqAcvNv0NwJNflr76PIGgi9nf1oguQV1Hpdm9TI2ALIQVn/9iIwLpBO5UcD2Jiw==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/prettier-plugin-svelte/-/prettier-plugin-svelte-3.0.0.tgz", + "integrity": "sha512-l3RQcPty2UBCoRh3yb9c5XCAmxkrc4BptAnbd5acO1gmSJtChOWkiEjnOvh7hvmtT4V80S8gXCOKAq8RNeIzSw==", "dev": true, "peerDependencies": { - "prettier": "^1.16.4 || ^2.0.0", - "svelte": "^3.2.0" + "prettier": "^3.0.0", + "svelte": "^3.2.0 || ^4.0.0-next.0" } }, "node_modules/pretty-format": { @@ -15782,15 +15782,15 @@ "dev": true }, "prettier": { - "version": "2.8.4", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.4.tgz", - "integrity": "sha512-vIS4Rlc2FNh0BySk3Wkd6xmwxB0FpOndW5fisM5H8hsZSxU2VWVB5CWIkIjWvrHjIhxk2g3bfMKM87zNTrZddw==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.0.tgz", + "integrity": "sha512-zBf5eHpwHOGPC47h0zrPyNn+eAEIdEzfywMoYn2XPi0P44Zp0tSq64rq0xAREh4auw2cJZHo9QUob+NqCQky4g==", "dev": true }, "prettier-plugin-svelte": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/prettier-plugin-svelte/-/prettier-plugin-svelte-2.9.0.tgz", - "integrity": "sha512-3doBi5NO4IVgaNPtwewvrgPpqAcvNv0NwJNflr76PIGgi9nf1oguQV1Hpdm9TI2ALIQVn/9iIwLpBO5UcD2Jiw==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/prettier-plugin-svelte/-/prettier-plugin-svelte-3.0.0.tgz", + "integrity": "sha512-l3RQcPty2UBCoRh3yb9c5XCAmxkrc4BptAnbd5acO1gmSJtChOWkiEjnOvh7hvmtT4V80S8gXCOKAq8RNeIzSw==", "dev": true }, "pretty-format": { diff --git a/package.json b/package.json index 77132a0..c13c92d 100644 --- a/package.json +++ b/package.json @@ -8,8 +8,8 @@ "compile-smui-theme-dark": "smui-theme compile src/treetop/generated/smui-dark.css -i src/theme/dark", "lint": "eslint ./src ./test", "lint:fix": "eslint ./src ./test --fix", - "prettier": "prettier --check ./src ./test", - "prettier:fix": "prettier --write ./src ./test", + "prettier": "prettier --check --plugin=prettier-plugin-svelte ./src ./test", + "prettier:fix": "prettier --write --plugin=prettier-plugin-svelte ./src ./test", "build": "concurrently --max-processes 1 \"npm:build:background_script\" \"npm:build:options\" \"npm:build:treetop\" \"npm:build:welcome\"", "build:watch": "concurrently \"npm:build:background_script:watch\" \"npm:build:options:watch\" \"npm:build:treetop:watch\" \"npm:build:welcome:watch\"", "build:background_script": "vite build --config vite.background_script.config.ts", @@ -63,8 +63,8 @@ "normalize.css": "^8.0.1", "postcss": "^8.4.26", "postcss-url": "^10.1.3", - "prettier": "^2.8.4", - "prettier-plugin-svelte": "^2.9.0", + "prettier": "3.0.0", + "prettier-plugin-svelte": "^3.0.0", "rollup-plugin-copy": "^3.4.0", "sass": "^1.63.6", "smui-theme": "^6.2.0", diff --git a/src/background_script/open-treetop.ts b/src/background_script/open-treetop.ts index 10c7429..78965a9 100644 --- a/src/background_script/open-treetop.ts +++ b/src/background_script/open-treetop.ts @@ -34,7 +34,7 @@ export const openWelcome = ({ */ export const openTreetop = ( _tab: Tabs.Tab, - info: Action.OnClickData | undefined + info: Action.OnClickData | undefined, ): void => { if (!info) { return; diff --git a/src/background_script/options.ts b/src/background_script/options.ts index 92320f9..924ef44 100644 --- a/src/background_script/options.ts +++ b/src/background_script/options.ts @@ -7,7 +7,7 @@ import type * as Treetop from '@Treetop/treetop/types'; * Set default options, leaving existing options unchanged. */ export const setDefaultOptions = async ( - defaultOptions: Record + defaultOptions: Record, ): Promise => { try { // Get stored options diff --git a/src/options/options.html b/src/options/options.html index b772dfd..8c9fcca 100644 --- a/src/options/options.html +++ b/src/options/options.html @@ -1,4 +1,4 @@ - + diff --git a/src/treetop/BookmarksManager.ts b/src/treetop/BookmarksManager.ts index fedce64..517ca00 100644 --- a/src/treetop/BookmarksManager.ts +++ b/src/treetop/BookmarksManager.ts @@ -11,7 +11,7 @@ import * as Treetop from './types'; export class BookmarksManager { constructor( private readonly nodeStoreMap: Treetop.NodeStoreMap, - private readonly builtInFolderInfo: Treetop.BuiltInFolderInfo + private readonly builtInFolderInfo: Treetop.BuiltInFolderInfo, ) {} /** @@ -27,12 +27,12 @@ export class BookmarksManager { // Firefox: Exclude Mobile Bookmarks folder rootNode.children = rootNode.children?.filter( - ({ id }) => id !== MOBILE_BOOKMARKS_GUID + ({ id }) => id !== MOBILE_BOOKMARKS_GUID, ); // Store built-in folder IDs (e.g. Other Bookmarks) this.builtInFolderInfo.builtInFolderIds = rootNode.children!.map( - ({ id }) => id + ({ id }) => id, ); // Initialize node stores for folders @@ -119,7 +119,7 @@ export class BookmarksManager { */ async handleBookmarkCreated( id: string, - bookmark: Bookmarks.BookmarkTreeNode + bookmark: Bookmarks.BookmarkTreeNode, ): Promise { if (isFolder(bookmark)) { // Add node store for the new folder @@ -140,7 +140,7 @@ export class BookmarksManager { */ async handleBookmarkRemoved( id: string, - removeInfo: Bookmarks.OnRemovedRemoveInfoType + removeInfo: Bookmarks.OnRemovedRemoveInfoType, ): Promise { const removedNodeIds = []; @@ -183,7 +183,7 @@ export class BookmarksManager { */ async handleBookmarkChanged( id: string, - _changeInfo: Bookmarks.OnChangedChangeInfoType + _changeInfo: Bookmarks.OnChangedChangeInfoType, ): Promise { if (this.nodeStoreMap.has(id)) { // Folder changed. Update its node. @@ -201,7 +201,7 @@ export class BookmarksManager { */ async handleBookmarkMoved( _id: string, - moveInfo: Bookmarks.OnMovedMoveInfoType + moveInfo: Bookmarks.OnMovedMoveInfoType, ): Promise { const parentId = moveInfo.parentId; const oldParentId = moveInfo.oldParentId; diff --git a/src/treetop/FilterManager.ts b/src/treetop/FilterManager.ts index 25be404..67dba51 100644 --- a/src/treetop/FilterManager.ts +++ b/src/treetop/FilterManager.ts @@ -18,7 +18,7 @@ export class FilterManager { constructor( private readonly filterSet: Treetop.FilterSet, - private readonly nodeStoreMap: Treetop.NodeStoreMap + private readonly nodeStoreMap: Treetop.NodeStoreMap, ) {} /** @@ -86,7 +86,7 @@ export class FilterManager { */ handleBookmarkCreated( _id: string, - bookmark: Bookmarks.BookmarkTreeNode + bookmark: Bookmarks.BookmarkTreeNode, ): void { if (this.filter === null) { return; @@ -151,7 +151,7 @@ export class FilterManager { */ handleBookmarkChanged( _id: string, - _changeInfo: Bookmarks.OnChangedChangeInfoType + _changeInfo: Bookmarks.OnChangedChangeInfoType, ): void { this.refreshFilter(); } @@ -162,7 +162,7 @@ export class FilterManager { */ handleBookmarkMoved( _id: string, - _moveInfo: Bookmarks.OnMovedMoveInfoType + _moveInfo: Bookmarks.OnMovedMoveInfoType, ): void { this.refreshFilter(); } diff --git a/src/treetop/HistoryManager.ts b/src/treetop/HistoryManager.ts index b0de2bf..3a27c03 100644 --- a/src/treetop/HistoryManager.ts +++ b/src/treetop/HistoryManager.ts @@ -83,7 +83,7 @@ export class HistoryManager { */ async handleBookmarkCreated( _id: string, - bookmark: Bookmarks.BookmarkTreeNode + bookmark: Bookmarks.BookmarkTreeNode, ): Promise { if (!isBookmark(bookmark)) { return; @@ -110,7 +110,7 @@ export class HistoryManager { */ async handleBookmarkChanged( id: string, - changeInfo: Bookmarks.OnChangedChangeInfoType + changeInfo: Bookmarks.OnChangedChangeInfoType, ): Promise { // Ignore changed folders if (changeInfo.url === undefined) { @@ -146,7 +146,7 @@ export class HistoryManager { * history. */ async handleVisitRemoved( - removed: History.OnVisitRemovedRemovedType + removed: History.OnVisitRemovedRemovedType, ): Promise { if (removed.allHistory) { // All history was removed diff --git a/src/treetop/PreferencesManager.ts b/src/treetop/PreferencesManager.ts index 6e310bb..3bfc018 100644 --- a/src/treetop/PreferencesManager.ts +++ b/src/treetop/PreferencesManager.ts @@ -30,7 +30,7 @@ export class PreferencesManager { */ createStore( name: string, - value: Treetop.PreferenceValue + value: Treetop.PreferenceValue, ): Writable { const store = writable(value); this.stores.set(name, store); @@ -60,7 +60,7 @@ export class PreferencesManager { */ private handleStorageChanged( changes: Record, - _areaName: string + _areaName: string, ): void { for (const key of Object.keys(changes)) { const value = changes[key].newValue as Treetop.PreferenceValue; diff --git a/src/treetop/PropertiesDialog.svelte b/src/treetop/PropertiesDialog.svelte index 99e2ac8..5ffe5aa 100644 --- a/src/treetop/PropertiesDialog.svelte +++ b/src/treetop/PropertiesDialog.svelte @@ -55,7 +55,7 @@ }); header = browser.i18n.getMessage( 'dialogHeadingBookmarkProperties', - truncatedTitle + truncatedTitle, ); } diff --git a/src/treetop/Treetop.svelte b/src/treetop/Treetop.svelte index 20259f9..3d2b555 100644 --- a/src/treetop/Treetop.svelte +++ b/src/treetop/Treetop.svelte @@ -41,7 +41,7 @@ const tooltips = preferencesManager.createStore('tooltips', true); const showRecentlyVisited = preferencesManager.createStore( 'showRecentlyVisited', - true + true, ); const colorScheme = preferencesManager.createStore('colorScheme', 'light'); @@ -82,7 +82,7 @@ // Bookmarks manager const bookmarksManager = new BookmarksManager( nodeStoreMap, - builtInFolderInfo + builtInFolderInfo, ); // History manager @@ -179,7 +179,7 @@ promises.push( browser.tabs.create({ url: child.url, - }) + }), ); } } @@ -293,7 +293,7 @@ async function asyncOnBookmarkCreated( id: string, - bookmark: Bookmarks.BookmarkTreeNode + bookmark: Bookmarks.BookmarkTreeNode, ) { const promises: Promise[] = []; @@ -317,29 +317,29 @@ async function asyncOnBookmarkRemoved( id: string, - removeInfo: Bookmarks.OnRemovedRemoveInfoType + removeInfo: Bookmarks.OnRemovedRemoveInfoType, ) { const removedNodeIds = await bookmarksManager.handleBookmarkRemoved( id, - removeInfo + removeInfo, ); filterManager.beginBatchRemove(); removedNodeIds.forEach((nodeId) => - filterManager.handleBookmarkRemoved(nodeId) + filterManager.handleBookmarkRemoved(nodeId), ); filterManager.endBatchRemove(); if ($showRecentlyVisited) { removedNodeIds.forEach((nodeId) => - historyManager.handleBookmarkRemoved(nodeId) + historyManager.handleBookmarkRemoved(nodeId), ); } } function onBookmarkRemoved( id: string, - removeInfo: Bookmarks.OnRemovedRemoveInfoType + removeInfo: Bookmarks.OnRemovedRemoveInfoType, ) { asyncOnBookmarkRemoved(id, removeInfo).catch((err) => { console.error(err); @@ -349,7 +349,7 @@ async function asyncOnBookmarkChanged( id: string, - changeInfo: Bookmarks.OnChangedChangeInfoType + changeInfo: Bookmarks.OnChangedChangeInfoType, ) { await bookmarksManager.handleBookmarkChanged(id, changeInfo); @@ -362,7 +362,7 @@ function onBookmarkChanged( id: string, - changeInfo: Bookmarks.OnChangedChangeInfoType + changeInfo: Bookmarks.OnChangedChangeInfoType, ) { asyncOnBookmarkChanged(id, changeInfo).catch((err) => { console.error(err); @@ -372,7 +372,7 @@ async function asyncOnBookmarkMoved( id: string, - moveInfo: Bookmarks.OnMovedMoveInfoType + moveInfo: Bookmarks.OnMovedMoveInfoType, ) { await bookmarksManager.handleBookmarkMoved(id, moveInfo); @@ -381,7 +381,7 @@ function onBookmarkMoved( id: string, - moveInfo: Bookmarks.OnMovedMoveInfoType + moveInfo: Bookmarks.OnMovedMoveInfoType, ) { asyncOnBookmarkMoved(id, moveInfo).catch((err) => { console.error(err); @@ -407,7 +407,7 @@ } async function asyncOnVisitRemoved( - removed: History.OnVisitRemovedRemovedType + removed: History.OnVisitRemovedRemovedType, ) { if ($showRecentlyVisited) { await historyManager.handleVisitRemoved(removed); @@ -557,16 +557,16 @@ builtInFolderInfo, nodeStoreMap, filterActive, - deleteBookmark - ) + deleteBookmark, + ), ); menuManager.registerMenuItem( 'openAllInTabs', - new OpenAllInTabsMenuItem(builtInFolderInfo, nodeStoreMap, openAllInTabs) + new OpenAllInTabsMenuItem(builtInFolderInfo, nodeStoreMap, openAllInTabs), ); menuManager.registerMenuItem( 'properties', - new PropertiesMenuItem(builtInFolderInfo, showPropertiesDialog) + new PropertiesMenuItem(builtInFolderInfo, showPropertiesDialog), ); window.addEventListener('hashchange', onHashChange); diff --git a/src/treetop/menus/DeleteMenuItem.ts b/src/treetop/menus/DeleteMenuItem.ts index 9404a4c..e2f4408 100644 --- a/src/treetop/menus/DeleteMenuItem.ts +++ b/src/treetop/menus/DeleteMenuItem.ts @@ -12,7 +12,7 @@ export class DeleteMenuItem extends MenuItem { private readonly builtInFolderInfo: Treetop.BuiltInFolderInfo, private readonly nodeStoreMap: Treetop.NodeStoreMap, private readonly filterActive: Writable, - onClickedCallback: OnClickedCallback + onClickedCallback: OnClickedCallback, ) { super(onClickedCallback); } diff --git a/src/treetop/menus/MenuManager.ts b/src/treetop/menus/MenuManager.ts index 62f488d..b56ed3b 100644 --- a/src/treetop/menus/MenuManager.ts +++ b/src/treetop/menus/MenuManager.ts @@ -30,7 +30,7 @@ export class MenuManager { */ async handleMenuShown( info: Menus.OnShownInfoType, - tab: Tabs.Tab + tab: Tabs.Tab, ): Promise { if (!info.contexts.includes('link') || info.viewType !== 'tab') { return; @@ -82,7 +82,7 @@ export class MenuManager { */ async handleMenuClicked( info: Menus.OnClickData, - tab?: Tabs.Tab + tab?: Tabs.Tab, ): Promise { // Store current active element; it may be cleared while waiting for an // asynchronous function call diff --git a/src/treetop/menus/OpenAllInTabsMenuItem.ts b/src/treetop/menus/OpenAllInTabsMenuItem.ts index a1a5b94..84ef9ad 100644 --- a/src/treetop/menus/OpenAllInTabsMenuItem.ts +++ b/src/treetop/menus/OpenAllInTabsMenuItem.ts @@ -11,7 +11,7 @@ export class OpenAllInTabsMenuItem extends MenuItem { constructor( private readonly builtInFolderInfo: Treetop.BuiltInFolderInfo, private readonly nodeStoreMap: Treetop.NodeStoreMap, - onClickedCallback: OnClickedCallback + onClickedCallback: OnClickedCallback, ) { super(onClickedCallback); } diff --git a/src/treetop/menus/PropertiesMenuItem.ts b/src/treetop/menus/PropertiesMenuItem.ts index 4adacae..cd42bda 100644 --- a/src/treetop/menus/PropertiesMenuItem.ts +++ b/src/treetop/menus/PropertiesMenuItem.ts @@ -8,7 +8,7 @@ import { MenuItem, type OnClickedCallback } from './MenuItem'; export class PropertiesMenuItem extends MenuItem { constructor( private readonly builtInFolderInfo: Treetop.BuiltInFolderInfo, - onClickedCallback: OnClickedCallback + onClickedCallback: OnClickedCallback, ) { super(onClickedCallback); } diff --git a/src/treetop/treetop.html b/src/treetop/treetop.html index 86894e2..30eae40 100644 --- a/src/treetop/treetop.html +++ b/src/treetop/treetop.html @@ -1,4 +1,4 @@ - + diff --git a/src/welcome/Welcome.svelte b/src/welcome/Welcome.svelte index 80630e9..647d664 100644 --- a/src/welcome/Welcome.svelte +++ b/src/welcome/Welcome.svelte @@ -26,7 +26,12 @@ :global(body) { background-color: var(--background-color); color: var(--color); - font-family: 'Open Sans', -apple-system, 'Segoe UI', 'Roboto', sans-serif; + font-family: + 'Open Sans', + -apple-system, + 'Segoe UI', + 'Roboto', + sans-serif; font-size: 1.75rem; font-weight: 400; } diff --git a/src/welcome/welcome.html b/src/welcome/welcome.html index 86894e2..30eae40 100644 --- a/src/welcome/welcome.html +++ b/src/welcome/welcome.html @@ -1,4 +1,4 @@ - + diff --git a/test/background_script/open-welcome.test.ts b/test/background_script/open-welcome.test.ts index 725de85..ebc2e4e 100644 --- a/test/background_script/open-welcome.test.ts +++ b/test/background_script/open-welcome.test.ts @@ -26,6 +26,6 @@ describe('welcome page', () => { reason, temporary: false, }); - } + }, ); }); diff --git a/test/options/Options.svelte.test.ts b/test/options/Options.svelte.test.ts index 30eb05f..6eb38f5 100644 --- a/test/options/Options.svelte.test.ts +++ b/test/options/Options.svelte.test.ts @@ -59,15 +59,15 @@ describe('Options', () => { expect(screen.getByLabelText(/^truncate/i)).toBeInTheDocument(); expect(screen.getByLabelText(/^tooltips/i)).toBeInTheDocument(); expect( - screen.getByLabelText(/^show recently visited/i) + screen.getByLabelText(/^show recently visited/i), ).toBeInTheDocument(); expect(screen.getByLabelText(/^light/i)).toBeInTheDocument(); expect(screen.getByLabelText(/^dark/i)).toBeInTheDocument(); expect( - screen.getByRole('link', { name: /^attributions$/i }) + screen.getByRole('link', { name: /^attributions$/i }), ).toBeInTheDocument(); expect( - screen.getByRole('link', { name: /^attributions$/i }) + screen.getByRole('link', { name: /^attributions$/i }), ).toHaveAttribute('href', expect.stringMatching(/^attributions\.txt$/)); }); }); diff --git a/test/treetop/Bookmark.svelte.test.ts b/test/treetop/Bookmark.svelte.test.ts index 966f6cb..3ead955 100644 --- a/test/treetop/Bookmark.svelte.test.ts +++ b/test/treetop/Bookmark.svelte.test.ts @@ -60,7 +60,7 @@ it('renders link with expected attributes', () => { 'visitedPastDay', 'visitedPastTwoDays', 'visitedPastThreeDays', - 'visitedPastWeek' + 'visitedPastWeek', ); }); @@ -86,7 +86,7 @@ describe('truncate option', () => { const link = screen.getByRole('link'); expect(link).toHaveTextContent( - new RegExp(`^${title.substring(0, title.length - 4)}.{3}$`) + new RegExp(`^${title.substring(0, title.length - 4)}.{3}$`), ); }); @@ -99,7 +99,7 @@ describe('truncate option', () => { const link = screen.getByRole('link'); const titleStart = title.substring(0, Math.floor(maxLength / 2)); expect(link).toHaveTextContent( - new RegExp(`^${escapeRegExp(titleStart)}.+\\S\\.{3}$`) + new RegExp(`^${escapeRegExp(titleStart)}.+\\S\\.{3}$`), ); }); @@ -136,7 +136,7 @@ describe('tooltips option', () => { const link = screen.getByRole('link'); expect(link).toHaveAttribute( 'title', - expect.stringMatching(`^${title}\n${url}$`) + expect.stringMatching(`^${title}\n${url}$`), ); }); @@ -150,9 +150,9 @@ describe('tooltips option', () => { 'title', expect.stringMatching( `^${title}\n${url.substring(0, 20)}.+\\.{3}.+${url.substring( - url.length - 10 - )}$` - ) + url.length - 10, + )}$`, + ), ); }); }); @@ -186,7 +186,7 @@ describe('sets class based on last visit time', () => { const link = screen.getByRole('link'); expect(link).toHaveClass(className); - } + }, ); it.each` @@ -205,7 +205,7 @@ describe('sets class based on last visit time', () => { 'visitedPastDay', 'visitedPastTwoDays', 'visitedPastThreeDays', - 'visitedPastWeek' + 'visitedPastWeek', ); }); }); diff --git a/test/treetop/BookmarksManager.test.ts b/test/treetop/BookmarksManager.test.ts index b694ad9..2cf35b5 100644 --- a/test/treetop/BookmarksManager.test.ts +++ b/test/treetop/BookmarksManager.test.ts @@ -16,7 +16,7 @@ import { } from '../utils/factories'; const getFolderNode = ( - store: Writable | undefined + store: Writable | undefined, ): Treetop.FolderNode => { if (store === undefined) { throw new TypeError(); @@ -53,7 +53,7 @@ describe('loadBookmarks', () => { expect(builtInFolderInfo.rootNodeId).toBe(bookmarksRoot.id); expect(builtInFolderInfo.builtInFolderIds).toEqual( - bookmarksRoot.children?.map((node) => node.id) + bookmarksRoot.children?.map((node) => node.id), ); }); @@ -243,11 +243,11 @@ describe('handleBookmarkCreated', () => { expect(nodeStoreMap.size).toBe(numBuiltInFolders + 1); expect(nodeStoreMap.get(baseNode.id)).toBeDefined(); expect(getFolderNode(nodeStoreMap.get(baseNode.id)).children).toHaveLength( - 2 + 2, ); expect(nodeStoreMap.get(folderNode.id)).toBeDefined(); expect( - getFolderNode(nodeStoreMap.get(folderNode.id)).children + getFolderNode(nodeStoreMap.get(folderNode.id)).children, ).toHaveLength(1); }); @@ -269,10 +269,10 @@ describe('handleBookmarkCreated', () => { // New bookmark node appears in parent node's children expect( - getFolderNode(nodeStoreMap.get(folderNode.id)).children + getFolderNode(nodeStoreMap.get(folderNode.id)).children, ).toHaveLength(2); expect( - getFolderNode(nodeStoreMap.get(folderNode.id)).children + getFolderNode(nodeStoreMap.get(folderNode.id)).children, ).toContainEqual({ id: node.id, type: Treetop.NodeType.Bookmark, @@ -299,10 +299,10 @@ describe('handleBookmarkCreated', () => { // New separator node appears in parent node's children expect( - getFolderNode(nodeStoreMap.get(folderNode.id)).children + getFolderNode(nodeStoreMap.get(folderNode.id)).children, ).toHaveLength(2); expect( - getFolderNode(nodeStoreMap.get(folderNode.id)).children + getFolderNode(nodeStoreMap.get(folderNode.id)).children, ).toContainEqual({ id: node.id, type: Treetop.NodeType.Separator, @@ -340,10 +340,10 @@ describe('handleBookmarkCreated', () => { // New folder node appears in parent node's children expect( - getFolderNode(nodeStoreMap.get(folderNode.id)).children + getFolderNode(nodeStoreMap.get(folderNode.id)).children, ).toHaveLength(2); expect( - getFolderNode(nodeStoreMap.get(folderNode.id)).children + getFolderNode(nodeStoreMap.get(folderNode.id)).children, ).toContainEqual({ id: node.id, type: Treetop.NodeType.Folder, @@ -386,15 +386,15 @@ describe('handleBookmarkRemoved', () => { expect(nodeStoreMap.size).toBe(numBuiltInFolders + 2); expect(nodeStoreMap.get(baseNode.id)).toBeDefined(); expect(getFolderNode(nodeStoreMap.get(baseNode.id)).children).toHaveLength( - 2 + 2, ); expect(nodeStoreMap.get(folderNode1.id)).toBeDefined(); expect( - getFolderNode(nodeStoreMap.get(folderNode1.id)).children.length + getFolderNode(nodeStoreMap.get(folderNode1.id)).children.length, ).toBe(3); expect(nodeStoreMap.get(folderNode2.id)).toBeDefined(); expect( - getFolderNode(nodeStoreMap.get(folderNode2.id)).children.length + getFolderNode(nodeStoreMap.get(folderNode2.id)).children.length, ).toBe(2); bookmarkNode1; @@ -410,7 +410,7 @@ describe('handleBookmarkRemoved', () => { .andResolve(children); expect(folderNode2.id).toBe(bookmarkNode4.parentId); expect( - getFolderNode(nodeStoreMap.get(folderNode2.id)).children.length + getFolderNode(nodeStoreMap.get(folderNode2.id)).children.length, ).toBe(2); const initialNodeStoreMapSize = nodeStoreMap.size; @@ -423,14 +423,14 @@ describe('handleBookmarkRemoved', () => { }; const removedNodeIds = await bookmarksManager.handleBookmarkRemoved( removeInfo.node.id, - removeInfo + removeInfo, ); expect(removedNodeIds).toHaveLength(1); expect(removedNodeIds).toContain(bookmarkNode4.id); expect(nodeStoreMap.size).toBe(initialNodeStoreMapSize); expect( - getFolderNode(nodeStoreMap.get(folderNode2.id)).children.length + getFolderNode(nodeStoreMap.get(folderNode2.id)).children.length, ).toBe(1); }); @@ -444,7 +444,7 @@ describe('handleBookmarkRemoved', () => { .andResolve(children); expect(folderNode2.id).toBe(separatorNode.parentId); expect( - getFolderNode(nodeStoreMap.get(folderNode2.id)).children.length + getFolderNode(nodeStoreMap.get(folderNode2.id)).children.length, ).toBe(2); const initialNodeStoreMapSize = nodeStoreMap.size; @@ -456,14 +456,14 @@ describe('handleBookmarkRemoved', () => { }; const removedNodeIds = await bookmarksManager.handleBookmarkRemoved( removeInfo.node.id, - removeInfo + removeInfo, ); expect(removedNodeIds).toHaveLength(1); expect(removedNodeIds).toContain(separatorNode.id); expect(nodeStoreMap.size).toBe(initialNodeStoreMapSize); expect( - getFolderNode(nodeStoreMap.get(folderNode2.id)).children.length + getFolderNode(nodeStoreMap.get(folderNode2.id)).children.length, ).toBe(1); }); @@ -474,13 +474,13 @@ describe('handleBookmarkRemoved', () => { mockBrowser.bookmarks.getChildren.expect(baseNode.id).andResolve(children); expect(baseNode.id).toBe(folderNode1.parentId); expect(getFolderNode(nodeStoreMap.get(baseNode.id)).children).toHaveLength( - 2 + 2, ); expect( - getFolderNode(nodeStoreMap.get(folderNode1.id)).children.length + getFolderNode(nodeStoreMap.get(folderNode1.id)).children.length, ).toBe(3); expect( - getFolderNode(nodeStoreMap.get(folderNode2.id)).children.length + getFolderNode(nodeStoreMap.get(folderNode2.id)).children.length, ).toBe(2); const initialNodeStoreMapSize = nodeStoreMap.size; @@ -492,7 +492,7 @@ describe('handleBookmarkRemoved', () => { }; const removedNodeIds = await bookmarksManager.handleBookmarkRemoved( removeInfo.node.id, - removeInfo + removeInfo, ); expect(removedNodeIds).toHaveLength(6); @@ -504,7 +504,7 @@ describe('handleBookmarkRemoved', () => { expect(removedNodeIds).toContain(separatorNode.id); expect(nodeStoreMap.size).toBe(initialNodeStoreMapSize - 2); expect(getFolderNode(nodeStoreMap.get(baseNode.id)).children).toHaveLength( - 1 + 1, ); }); }); @@ -530,30 +530,30 @@ describe('handleBookmarkChanged', () => { expect(nodeStoreMap.size).toBe(numBuiltInFolders + 1); expect(nodeStoreMap.get(baseNode.id)).toBeDefined(); expect(getFolderNode(nodeStoreMap.get(baseNode.id)).children).toHaveLength( - 1 + 1, ); expect(nodeStoreMap.get(folderNode1.id)).toBeDefined(); expect( - getFolderNode(nodeStoreMap.get(folderNode1.id)).children.length + getFolderNode(nodeStoreMap.get(folderNode1.id)).children.length, ).toBe(2); }); it('changed bookmark', async () => { expect(folderNode1.id).toBe(bookmarkNode1.parentId); expect( - getFolderNode(nodeStoreMap.get(folderNode1.id)).children.length + getFolderNode(nodeStoreMap.get(folderNode1.id)).children.length, ).toBe(2); expect( ( getFolderNode(nodeStoreMap.get(folderNode1.id)) .children[0] as Treetop.BookmarkNode - ).title + ).title, ).toBe(bookmarkNode1.title); expect( ( getFolderNode(nodeStoreMap.get(folderNode1.id)) .children[0] as Treetop.BookmarkNode - ).url + ).url, ).toBe(bookmarkNode1.url); const initialNodeStoreMapSize = nodeStoreMap.size; @@ -577,31 +577,31 @@ describe('handleBookmarkChanged', () => { expect(nodeStoreMap.size).toBe(initialNodeStoreMapSize); expect( - getFolderNode(nodeStoreMap.get(folderNode1.id)).children.length + getFolderNode(nodeStoreMap.get(folderNode1.id)).children.length, ).toBe(2); expect( ( getFolderNode(nodeStoreMap.get(folderNode1.id)) .children[0] as Treetop.BookmarkNode - ).title + ).title, ).toBe(bookmarkNode1.title); expect( ( getFolderNode(nodeStoreMap.get(folderNode1.id)) .children[0] as Treetop.BookmarkNode - ).url + ).url, ).toBe(bookmarkNode1.url); }); it('changed folder', async () => { expect( - getFolderNode(nodeStoreMap.get(folderNode1.id)).children.length + getFolderNode(nodeStoreMap.get(folderNode1.id)).children.length, ).toBe(2); expect(getFolderNode(nodeStoreMap.get(folderNode1.id)).children[0].id).toBe( - bookmarkNode1.id + bookmarkNode1.id, ); expect(getFolderNode(nodeStoreMap.get(folderNode1.id)).children[1].id).toBe( - bookmarkNode2.id + bookmarkNode2.id, ); const initialNodeStoreMapSize = nodeStoreMap.size; @@ -619,16 +619,16 @@ describe('handleBookmarkChanged', () => { expect(nodeStoreMap.size).toBe(initialNodeStoreMapSize); expect(getFolderNode(nodeStoreMap.get(folderNode1.id)).title).toBe( - folderNode1.title + folderNode1.title, ); expect( - getFolderNode(nodeStoreMap.get(folderNode1.id)).children.length + getFolderNode(nodeStoreMap.get(folderNode1.id)).children.length, ).toBe(2); expect(getFolderNode(nodeStoreMap.get(folderNode1.id)).children[0].id).toBe( - bookmarkNode1.id + bookmarkNode1.id, ); expect(getFolderNode(nodeStoreMap.get(folderNode1.id)).children[1].id).toBe( - bookmarkNode2.id + bookmarkNode2.id, ); }); }); @@ -657,11 +657,11 @@ describe('handleBookmarkMoved', () => { expect(nodeStoreMap.size).toBe(numBuiltInFolders + 1); expect(nodeStoreMap.get(baseNode.id)).toBeDefined(); expect(getFolderNode(nodeStoreMap.get(baseNode.id)).children).toHaveLength( - 2 + 2, ); expect(nodeStoreMap.get(folderNode1.id)).toBeDefined(); expect( - getFolderNode(nodeStoreMap.get(folderNode1.id)).children.length + getFolderNode(nodeStoreMap.get(folderNode1.id)).children.length, ).toBe(2); bookmarkNode1; }); @@ -672,10 +672,10 @@ describe('handleBookmarkMoved', () => { expect(folderNode1.id).toBe(bookmarkNode2.parentId); expect(folderNode1.id).toBe(bookmarkNode3.parentId); expect(getFolderNode(nodeStoreMap.get(folderNode1.id)).children[0].id).toBe( - bookmarkNode2.id + bookmarkNode2.id, ); expect(getFolderNode(nodeStoreMap.get(folderNode1.id)).children[1].id).toBe( - bookmarkNode3.id + bookmarkNode3.id, ); const initialNodeStoreMapSize = nodeStoreMap.size; @@ -698,13 +698,13 @@ describe('handleBookmarkMoved', () => { expect(nodeStoreMap.size).toBe(initialNodeStoreMapSize); expect( - getFolderNode(nodeStoreMap.get(folderNode1.id)).children.length + getFolderNode(nodeStoreMap.get(folderNode1.id)).children.length, ).toBe(2); expect(getFolderNode(nodeStoreMap.get(folderNode1.id)).children[0].id).toBe( - bookmarkNode3.id + bookmarkNode3.id, ); expect(getFolderNode(nodeStoreMap.get(folderNode1.id)).children[1].id).toBe( - bookmarkNode2.id + bookmarkNode2.id, ); }); @@ -714,16 +714,16 @@ describe('handleBookmarkMoved', () => { expect(folderNode1.id).toBe(bookmarkNode2.parentId); expect(folderNode1.id).toBe(bookmarkNode3.parentId); expect(getFolderNode(nodeStoreMap.get(baseNode.id)).children[0].id).toBe( - bookmarkNode1.id + bookmarkNode1.id, ); expect(getFolderNode(nodeStoreMap.get(baseNode.id)).children[1].id).toBe( - folderNode1.id + folderNode1.id, ); expect(getFolderNode(nodeStoreMap.get(folderNode1.id)).children[0].id).toBe( - bookmarkNode2.id + bookmarkNode2.id, ); expect(getFolderNode(nodeStoreMap.get(folderNode1.id)).children[1].id).toBe( - bookmarkNode3.id + bookmarkNode3.id, ); const initialNodeStoreMapSize = nodeStoreMap.size; @@ -749,22 +749,22 @@ describe('handleBookmarkMoved', () => { expect(nodeStoreMap.size).toBe(initialNodeStoreMapSize); expect(getFolderNode(nodeStoreMap.get(baseNode.id)).children).toHaveLength( - 3 + 3, ); expect(getFolderNode(nodeStoreMap.get(baseNode.id)).children[0].id).toBe( - bookmarkNode3.id + bookmarkNode3.id, ); expect(getFolderNode(nodeStoreMap.get(baseNode.id)).children[1].id).toBe( - bookmarkNode1.id + bookmarkNode1.id, ); expect(getFolderNode(nodeStoreMap.get(baseNode.id)).children[2].id).toBe( - folderNode1.id + folderNode1.id, ); expect( - getFolderNode(nodeStoreMap.get(folderNode1.id)).children.length + getFolderNode(nodeStoreMap.get(folderNode1.id)).children.length, ).toBe(1); expect(getFolderNode(nodeStoreMap.get(folderNode1.id)).children[0].id).toBe( - bookmarkNode2.id + bookmarkNode2.id, ); }); @@ -774,16 +774,16 @@ describe('handleBookmarkMoved', () => { expect(folderNode1.id).toBe(bookmarkNode2.parentId); expect(folderNode1.id).toBe(bookmarkNode3.parentId); expect(getFolderNode(nodeStoreMap.get(baseNode.id)).children[0].id).toBe( - bookmarkNode1.id + bookmarkNode1.id, ); expect(getFolderNode(nodeStoreMap.get(baseNode.id)).children[1].id).toBe( - folderNode1.id + folderNode1.id, ); expect(getFolderNode(nodeStoreMap.get(folderNode1.id)).children[0].id).toBe( - bookmarkNode2.id + bookmarkNode2.id, ); expect(getFolderNode(nodeStoreMap.get(folderNode1.id)).children[1].id).toBe( - bookmarkNode3.id + bookmarkNode3.id, ); const initialNodeStoreMapSize = nodeStoreMap.size; @@ -809,22 +809,22 @@ describe('handleBookmarkMoved', () => { expect(nodeStoreMap.size).toBe(initialNodeStoreMapSize); expect(getFolderNode(nodeStoreMap.get(baseNode.id)).children).toHaveLength( - 1 + 1, ); expect(getFolderNode(nodeStoreMap.get(baseNode.id)).children[0].id).toBe( - folderNode1.id + folderNode1.id, ); expect( - getFolderNode(nodeStoreMap.get(folderNode1.id)).children.length + getFolderNode(nodeStoreMap.get(folderNode1.id)).children.length, ).toBe(3); expect(getFolderNode(nodeStoreMap.get(folderNode1.id)).children[0].id).toBe( - bookmarkNode1.id + bookmarkNode1.id, ); expect(getFolderNode(nodeStoreMap.get(folderNode1.id)).children[1].id).toBe( - bookmarkNode2.id + bookmarkNode2.id, ); expect(getFolderNode(nodeStoreMap.get(folderNode1.id)).children[2].id).toBe( - bookmarkNode3.id + bookmarkNode3.id, ); }); }); diff --git a/test/treetop/FilterManager.test.ts b/test/treetop/FilterManager.test.ts index f15897c..b7b4cc9 100644 --- a/test/treetop/FilterManager.test.ts +++ b/test/treetop/FilterManager.test.ts @@ -22,7 +22,7 @@ const NUM_RANDOM_WORDS = 3; // Generate a random string that contains the specified string. const randomStringContaining = (str: string) => { return `${faker.random.words(NUM_RANDOM_WORDS)}${str}${faker.random.words( - NUM_RANDOM_WORDS + NUM_RANDOM_WORDS, )}`; }; @@ -428,7 +428,7 @@ describe('handleBookmarkRemoved', () => { expect(filterSet.size).toBe(2); folderNode1.children = folderNode1.children.filter( - (child) => child.id !== bookmarkNode.id + (child) => child.id !== bookmarkNode.id, ); filterManager.handleBookmarkRemoved(bookmarkNode.id); @@ -451,7 +451,7 @@ describe('handleBookmarkRemoved', () => { expect(filterSet.size).toBe(3); folderNode1.children = folderNode1.children.filter( - (child) => child.id !== bookmarkNode1.id + (child) => child.id !== bookmarkNode1.id, ); filterManager.handleBookmarkRemoved(bookmarkNode1.id); @@ -478,7 +478,7 @@ describe('handleBookmarkRemoved', () => { expect(filterSet.size).toBe(4); folderNode1.children = folderNode1.children.filter( - (child) => child.id !== bookmarkNode1.id + (child) => child.id !== bookmarkNode1.id, ); filterManager.handleBookmarkRemoved(bookmarkNode1.id); @@ -504,7 +504,7 @@ describe('handleBookmarkRemoved', () => { expect(filterSet.size).toBe(4); folderNode3.children = folderNode3.children.filter( - (child) => child.id !== bookmarkNode.id + (child) => child.id !== bookmarkNode.id, ); expect(filterSet.has(bookmarkNode.id)).toBe(true); @@ -534,7 +534,7 @@ describe('handleBookmarkRemoved', () => { expect(filterSet.size).toBe(4); folderNode2.children = folderNode2.children.filter( - (child) => child.id !== bookmarkNode1.id + (child) => child.id !== bookmarkNode1.id, ); filterManager.handleBookmarkRemoved(bookmarkNode1.id); @@ -563,7 +563,7 @@ describe('handleBookmarkRemoved', () => { expect(filterSet.size).toBe(5); folderNode2.children = folderNode2.children.filter( - (child) => child.id !== bookmarkNode1.id + (child) => child.id !== bookmarkNode1.id, ); filterManager.handleBookmarkRemoved(bookmarkNode1.id); @@ -585,7 +585,7 @@ describe('handleBookmarkRemoved', () => { expect(filterSet.size).toBe(0); folderNode1.children = folderNode1.children.filter( - (child) => child.id !== bookmarkNode.id + (child) => child.id !== bookmarkNode.id, ); filterManager.handleBookmarkRemoved(bookmarkNode.id); @@ -602,7 +602,7 @@ describe('handleBookmarkRemoved', () => { expect(filterSet.size).toBe(0); folderNode2.children = folderNode2.children.filter( - (child) => child.id !== bookmarkNode.id + (child) => child.id !== bookmarkNode.id, ); filterManager.handleBookmarkRemoved(bookmarkNode.id); @@ -631,7 +631,7 @@ describe('handleBookmarkRemoved', () => { filterManager.beginBatchRemove(); removedNodeIds.forEach((nodeId) => - filterManager.handleBookmarkRemoved(nodeId) + filterManager.handleBookmarkRemoved(nodeId), ); filterManager.endBatchRemove(); @@ -653,7 +653,7 @@ describe('handleBookmarkRemoved', () => { filterManager.beginBatchRemove(); removedNodeIds.forEach((nodeId) => - filterManager.handleBookmarkRemoved(nodeId) + filterManager.handleBookmarkRemoved(nodeId), ); filterManager.endBatchRemove(); @@ -808,7 +808,7 @@ describe('handleBookmarkChanged', () => { bookmarkNode.title = bookmarkNode.title.replace( filter, - faker.random.word() + faker.random.word(), ); const changeInfo: Bookmarks.OnChangedChangeInfoType = { @@ -859,7 +859,7 @@ describe('handleBookmarkChanged', () => { bookmarkNode1.title = bookmarkNode1.title.replace( filter, - faker.random.word() + faker.random.word(), ); const changeInfo: Bookmarks.OnChangedChangeInfoType = { @@ -892,7 +892,7 @@ describe('handleBookmarkChanged', () => { bookmarkNode1.title = bookmarkNode1.title.replace( filter, - faker.random.word() + faker.random.word(), ); const changeInfo: Bookmarks.OnChangedChangeInfoType = { @@ -986,7 +986,7 @@ describe('handleBookmarkMoved', () => { // Move bookmarkNode to parent folder folderNode2.children.unshift(bookmarkNode); folderNode3.children = folderNode3.children.filter( - (node) => node.id !== bookmarkNode.id + (node) => node.id !== bookmarkNode.id, ); const moveInfo: Bookmarks.OnMovedMoveInfoType = { @@ -1023,7 +1023,7 @@ describe('handleBookmarkMoved', () => { // Move bookmarkNode2 to parent folder folderNode2.children.unshift(bookmarkNode2); folderNode3.children = folderNode3.children.filter( - (node) => node.id !== bookmarkNode2.id + (node) => node.id !== bookmarkNode2.id, ); const moveInfo: Bookmarks.OnMovedMoveInfoType = { @@ -1058,7 +1058,7 @@ describe('handleBookmarkMoved', () => { // Move bookmarkNode to child folder folderNode4.children.unshift(bookmarkNode); folderNode2.children = folderNode2.children.filter( - (node) => node.id !== bookmarkNode.id + (node) => node.id !== bookmarkNode.id, ); const moveInfo: Bookmarks.OnMovedMoveInfoType = { @@ -1095,7 +1095,7 @@ describe('handleBookmarkMoved', () => { // Move bookmarkNode2 to child folder folderNode4.children.unshift(bookmarkNode2); folderNode2.children = folderNode2.children.filter( - (node) => node.id !== bookmarkNode2.id + (node) => node.id !== bookmarkNode2.id, ); const moveInfo: Bookmarks.OnMovedMoveInfoType = { @@ -1130,7 +1130,7 @@ describe('handleBookmarkMoved', () => { // Move bookmarkNode to sibling folder folderNode5.children.unshift(bookmarkNode); folderNode2.children = folderNode2.children.filter( - (node) => node.id !== bookmarkNode.id + (node) => node.id !== bookmarkNode.id, ); const moveInfo: Bookmarks.OnMovedMoveInfoType = { @@ -1166,7 +1166,7 @@ describe('handleBookmarkMoved', () => { // Move bookmarkNode2 to sibling folder folderNode5.children.unshift(bookmarkNode2); folderNode2.children = folderNode2.children.filter( - (node) => node.id !== bookmarkNode2.id + (node) => node.id !== bookmarkNode2.id, ); const moveInfo: Bookmarks.OnMovedMoveInfoType = { @@ -1202,7 +1202,7 @@ describe('handleBookmarkMoved', () => { // Move bookmarkNode to distant folder folderNode6.children.unshift(bookmarkNode); folderNode3.children = folderNode3.children.filter( - (node) => node.id !== bookmarkNode.id + (node) => node.id !== bookmarkNode.id, ); const moveInfo: Bookmarks.OnMovedMoveInfoType = { @@ -1240,7 +1240,7 @@ describe('handleBookmarkMoved', () => { // Move bookmarkNode2 to distant folder folderNode6.children.unshift(bookmarkNode2); folderNode3.children = folderNode3.children.filter( - (node) => node.id !== bookmarkNode2.id + (node) => node.id !== bookmarkNode2.id, ); const moveInfo: Bookmarks.OnMovedMoveInfoType = { @@ -1277,7 +1277,7 @@ describe('handleBookmarkMoved', () => { // Move folderNode2 within folderNode1 expect(folderNode2.parentId!).toBe(folderNode1.id); const oldIndex = folderNode1.children.findIndex( - (node) => node.id === folderNode2.id + (node) => node.id === folderNode2.id, ); expect(oldIndex).toBe(4); const newIndex = folderNode1.children.length - 1; @@ -1319,13 +1319,13 @@ describe('handleBookmarkMoved', () => { // Move folderNode3 to folderNode1 expect(folderNode3.parentId!).toBe(folderNode2.id); const oldIndex = folderNode2.children.findIndex( - (node) => node.id === folderNode3.id + (node) => node.id === folderNode3.id, ); expect(oldIndex).toBe(3); const newIndex = folderNode1.children.length - 1; folderNode2.children = folderNode2.children.filter( - (node) => node.id !== folderNode3.id + (node) => node.id !== folderNode3.id, ); folderNode3.parentId = folderNode1.id; folderNode1.children.push(folderNode3); @@ -1361,13 +1361,13 @@ describe('handleBookmarkMoved', () => { // Move folderNode3 to folderNode5 expect(folderNode3.parentId!).toBe(folderNode2.id); const oldIndex = folderNode2.children.findIndex( - (node) => node.id === folderNode3.id + (node) => node.id === folderNode3.id, ); expect(oldIndex).toBe(3); const newIndex = folderNode5.children.length - 1; folderNode2.children = folderNode2.children.filter( - (node) => node.id !== folderNode3.id + (node) => node.id !== folderNode3.id, ); folderNode3.parentId = folderNode5.id; folderNode5.children.push(folderNode3); @@ -1414,7 +1414,7 @@ describe('handleBookmarkMoved', () => { // Move folderNode2 within folderNode1 expect(folderNode2.parentId!).toBe(folderNode1.id); const oldIndex = folderNode1.children.findIndex( - (node) => node.id === folderNode2.id + (node) => node.id === folderNode2.id, ); expect(oldIndex).toBe(4); const newIndex = folderNode1.children.length - 1; diff --git a/test/treetop/Folder.svelte.test.ts b/test/treetop/Folder.svelte.test.ts index b9da61f..1afd1cf 100644 --- a/test/treetop/Folder.svelte.test.ts +++ b/test/treetop/Folder.svelte.test.ts @@ -65,7 +65,7 @@ const expectDocumentTitle = (title: string) => { */ const expectToBeInContentsOfFolder = ( child: HTMLElement, - headerLink: HTMLElement + headerLink: HTMLElement, ) => { const contents = child.parentElement; expect(contents).not.toBeNull(); @@ -134,7 +134,7 @@ describe('rooted at bookmarks root', () => { it('renders', () => { expect( - screen.getByRole('link', { name: rootNode.title }) + screen.getByRole('link', { name: rootNode.title }), ).toBeInTheDocument(); expect(screen.getByText(/^empty folder/i)).toBeInTheDocument(); @@ -216,10 +216,10 @@ describe('rooted at bookmarks root', () => { it('renders', () => { expect( - screen.getByRole('link', { name: rootNode.title }) + screen.getByRole('link', { name: rootNode.title }), ).toBeInTheDocument(); expect( - screen.getByRole('link', { name: folderNode.title }) + screen.getByRole('link', { name: folderNode.title }), ).toBeInTheDocument(); expect(screen.getByText(/^empty folder/i)).toBeInTheDocument(); @@ -278,29 +278,29 @@ describe('rooted at bookmarks root', () => { it('renders', () => { expect( - screen.getByRole('link', { name: rootNode.title }) + screen.getByRole('link', { name: rootNode.title }), ).toBeInTheDocument(); expect( - screen.getByRole('link', { name: folderNode1.title }) + screen.getByRole('link', { name: folderNode1.title }), ).toBeInTheDocument(); expect( - screen.getByRole('link', { name: folderNode2.title }) + screen.getByRole('link', { name: folderNode2.title }), ).toBeInTheDocument(); expect(screen.queryByText(/^empty folder/i)).not.toBeInTheDocument(); expect( screen.getByRole('link', { name: (folderNode1.children[0] as Treetop.BookmarkNode).title, - }) + }), ).toBeInTheDocument(); expect( screen.getByRole('link', { name: (folderNode1.children[1] as Treetop.BookmarkNode).title, - }) + }), ).toBeInTheDocument(); expect( screen.getByRole('link', { name: (folderNode2.children[0] as Treetop.BookmarkNode).title, - }) + }), ).toBeInTheDocument(); const rootNodeLink = screen.getByRole('link', { name: rootNode.title }); @@ -323,12 +323,12 @@ describe('rooted at bookmarks root', () => { expect(bookmarkLink1.dataset.nodeId).toBe(folderNode1.children[0].id); expect(bookmarkLink1).toHaveAttribute( 'href', - (folderNode1.children[0] as Treetop.BookmarkNode).url + (folderNode1.children[0] as Treetop.BookmarkNode).url, ); expect(bookmarkLink2.dataset.nodeId).toBe(folderNode1.children[1].id); expect(bookmarkLink2).toHaveAttribute( 'href', - (folderNode1.children[1] as Treetop.BookmarkNode).url + (folderNode1.children[1] as Treetop.BookmarkNode).url, ); expectToBeInContentsOfFolder(bookmarkLink1, folderNode1Link); expectToBeInContentsOfFolder(bookmarkLink2, folderNode1Link); @@ -346,7 +346,7 @@ describe('rooted at bookmarks root', () => { expect(bookmarkLink3.dataset.nodeId).toBe(folderNode2.children[0].id); expect(bookmarkLink3).toHaveAttribute( 'href', - (folderNode2.children[0] as Treetop.BookmarkNode).url + (folderNode2.children[0] as Treetop.BookmarkNode).url, ); expectToBeInContentsOfFolder(bookmarkLink3, folderNode2Link); }); @@ -392,24 +392,24 @@ describe('rooted at bookmarks root', () => { it('renders', () => { expect( - screen.getByRole('link', { name: rootNode.title }) + screen.getByRole('link', { name: rootNode.title }), ).toBeInTheDocument(); expect( - screen.getByRole('link', { name: folderNode1.title }) + screen.getByRole('link', { name: folderNode1.title }), ).toBeInTheDocument(); expect( - screen.getByRole('link', { name: folderNode2.title }) + screen.getByRole('link', { name: folderNode2.title }), ).toBeInTheDocument(); expect(screen.queryByText(/^empty folder/i)).not.toBeInTheDocument(); expect( screen.getByRole('link', { name: (folderNode1.children[0] as Treetop.BookmarkNode).title, - }) + }), ).toBeInTheDocument(); expect( screen.getByRole('link', { name: (folderNode2.children[0] as Treetop.BookmarkNode).title, - }) + }), ).toBeInTheDocument(); expect(screen.getByRole('separator')).toBeInTheDocument(); @@ -430,7 +430,7 @@ describe('rooted at bookmarks root', () => { expect(bookmarkLink1.dataset.nodeId).toBe(folderNode1.children[0].id); expect(bookmarkLink1).toHaveAttribute( 'href', - (folderNode1.children[0] as Treetop.BookmarkNode).url + (folderNode1.children[0] as Treetop.BookmarkNode).url, ); expectToBeInContentsOfFolder(bookmarkLink1, folderNode1Link); @@ -447,7 +447,7 @@ describe('rooted at bookmarks root', () => { expect(bookmarkLink2.dataset.nodeId).toBe(folderNode2.children[0].id); expect(bookmarkLink2).toHaveAttribute( 'href', - (folderNode2.children[0] as Treetop.BookmarkNode).url + (folderNode2.children[0] as Treetop.BookmarkNode).url, ); expectToBeInContentsOfFolder(bookmarkLink2, folderNode2Link); @@ -504,27 +504,27 @@ describe('rooted at subfolder', () => { it('renders when rooted at subfolder', () => { expect( - screen.getByRole('link', { name: rootNode.title }) + screen.getByRole('link', { name: rootNode.title }), ).toBeInTheDocument(); expect( - screen.queryByRole('link', { name: folderNode1.title }) + screen.queryByRole('link', { name: folderNode1.title }), ).not.toBeInTheDocument(); expect( - screen.getByRole('link', { name: folderNode2.title }) + screen.getByRole('link', { name: folderNode2.title }), ).toBeInTheDocument(); expect( - screen.getByRole('link', { name: folderNode3.title }) + screen.getByRole('link', { name: folderNode3.title }), ).toBeInTheDocument(); expect(screen.queryByText(/^empty folder/i)).not.toBeInTheDocument(); expect( screen.getByRole('link', { name: (folderNode2.children[0] as Treetop.BookmarkNode).title, - }) + }), ).toBeInTheDocument(); expect( screen.getByRole('link', { name: (folderNode3.children[0] as Treetop.BookmarkNode).title, - }) + }), ).toBeInTheDocument(); const rootNodeLink = screen.getByRole('link', { name: rootNode.title }); @@ -543,7 +543,7 @@ describe('rooted at subfolder', () => { expect(bookmarkLink1.dataset.nodeId).toBe(folderNode2.children[0].id); expect(bookmarkLink1).toHaveAttribute( 'href', - (folderNode2.children[0] as Treetop.BookmarkNode).url + (folderNode2.children[0] as Treetop.BookmarkNode).url, ); expectToBeInContentsOfFolder(bookmarkLink1, folderNode2Link); @@ -560,7 +560,7 @@ describe('rooted at subfolder', () => { expect(bookmarkLink2.dataset.nodeId).toBe(folderNode3.children[0].id); expect(bookmarkLink2).toHaveAttribute( 'href', - (folderNode3.children[0] as Treetop.BookmarkNode).url + (folderNode3.children[0] as Treetop.BookmarkNode).url, ); expectToBeInContentsOfFolder(bookmarkLink2, folderNode3Link); }); @@ -685,33 +685,33 @@ describe('filter active', () => { setup(); expect( - screen.getByRole('link', { name: folderNode1.title }) + screen.getByRole('link', { name: folderNode1.title }), ).toBeInTheDocument(); expect( - screen.getByRole('link', { name: bookmarkNode1.title }) + screen.getByRole('link', { name: bookmarkNode1.title }), ).toBeInTheDocument(); expect( - screen.queryByRole('link', { name: folderNode2.title }) + screen.queryByRole('link', { name: folderNode2.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: folderNode3.title }) + screen.queryByRole('link', { name: folderNode3.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode2.title }) + screen.queryByRole('link', { name: bookmarkNode2.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode3.title }) + screen.queryByRole('link', { name: bookmarkNode3.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode4.title }) + screen.queryByRole('link', { name: bookmarkNode4.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode5.title }) + screen.queryByRole('link', { name: bookmarkNode5.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode6.title }) + screen.queryByRole('link', { name: bookmarkNode6.title }), ).not.toBeInTheDocument(); }); @@ -726,33 +726,33 @@ describe('filter active', () => { setup(); expect( - screen.getByRole('link', { name: folderNode2.title }) + screen.getByRole('link', { name: folderNode2.title }), ).toBeInTheDocument(); expect( - screen.getByRole('link', { name: bookmarkNode3.title }) + screen.getByRole('link', { name: bookmarkNode3.title }), ).toBeInTheDocument(); expect( - screen.queryByRole('link', { name: folderNode1.title }) + screen.queryByRole('link', { name: folderNode1.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: folderNode3.title }) + screen.queryByRole('link', { name: folderNode3.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode1.title }) + screen.queryByRole('link', { name: bookmarkNode1.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode2.title }) + screen.queryByRole('link', { name: bookmarkNode2.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode4.title }) + screen.queryByRole('link', { name: bookmarkNode4.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode5.title }) + screen.queryByRole('link', { name: bookmarkNode5.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode6.title }) + screen.queryByRole('link', { name: bookmarkNode6.title }), ).not.toBeInTheDocument(); }); @@ -769,33 +769,33 @@ describe('filter active', () => { setup(); expect( - screen.getByRole('link', { name: folderNode1.title }) + screen.getByRole('link', { name: folderNode1.title }), ).toBeInTheDocument(); expect( - screen.getByRole('link', { name: folderNode2.title }) + screen.getByRole('link', { name: folderNode2.title }), ).toBeInTheDocument(); expect( - screen.getByRole('link', { name: bookmarkNode1.title }) + screen.getByRole('link', { name: bookmarkNode1.title }), ).toBeInTheDocument(); expect( - screen.getByRole('link', { name: bookmarkNode3.title }) + screen.getByRole('link', { name: bookmarkNode3.title }), ).toBeInTheDocument(); expect( - screen.queryByRole('link', { name: folderNode3.title }) + screen.queryByRole('link', { name: folderNode3.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode2.title }) + screen.queryByRole('link', { name: bookmarkNode2.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode4.title }) + screen.queryByRole('link', { name: bookmarkNode4.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode5.title }) + screen.queryByRole('link', { name: bookmarkNode5.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode6.title }) + screen.queryByRole('link', { name: bookmarkNode6.title }), ).not.toBeInTheDocument(); }); @@ -811,33 +811,33 @@ describe('filter active', () => { setup(); expect( - screen.getByRole('link', { name: folderNode2.title }) + screen.getByRole('link', { name: folderNode2.title }), ).toBeInTheDocument(); expect( - screen.getByRole('link', { name: folderNode3.title }) + screen.getByRole('link', { name: folderNode3.title }), ).toBeInTheDocument(); expect( - screen.getByRole('link', { name: bookmarkNode5.title }) + screen.getByRole('link', { name: bookmarkNode5.title }), ).toBeInTheDocument(); expect( - screen.queryByRole('link', { name: folderNode1.title }) + screen.queryByRole('link', { name: folderNode1.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode1.title }) + screen.queryByRole('link', { name: bookmarkNode1.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode2.title }) + screen.queryByRole('link', { name: bookmarkNode2.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode3.title }) + screen.queryByRole('link', { name: bookmarkNode3.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode4.title }) + screen.queryByRole('link', { name: bookmarkNode4.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode6.title }) + screen.queryByRole('link', { name: bookmarkNode6.title }), ).not.toBeInTheDocument(); }); @@ -855,32 +855,32 @@ describe('filter active', () => { setup(); expect( - screen.getByRole('link', { name: folderNode1.title }) + screen.getByRole('link', { name: folderNode1.title }), ).toBeInTheDocument(); expect( - screen.getByRole('link', { name: folderNode2.title }) + screen.getByRole('link', { name: folderNode2.title }), ).toBeInTheDocument(); expect( - screen.getByRole('link', { name: folderNode3.title }) + screen.getByRole('link', { name: folderNode3.title }), ).toBeInTheDocument(); expect( - screen.getByRole('link', { name: bookmarkNode1.title }) + screen.getByRole('link', { name: bookmarkNode1.title }), ).toBeInTheDocument(); expect( - screen.getByRole('link', { name: bookmarkNode5.title }) + screen.getByRole('link', { name: bookmarkNode5.title }), ).toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode2.title }) + screen.queryByRole('link', { name: bookmarkNode2.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode3.title }) + screen.queryByRole('link', { name: bookmarkNode3.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode4.title }) + screen.queryByRole('link', { name: bookmarkNode4.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode6.title }) + screen.queryByRole('link', { name: bookmarkNode6.title }), ).not.toBeInTheDocument(); }); @@ -899,32 +899,32 @@ describe('filter active', () => { setup(); expect( - screen.getByRole('link', { name: folderNode1.title }) + screen.getByRole('link', { name: folderNode1.title }), ).toBeInTheDocument(); expect( - screen.getByRole('link', { name: folderNode2.title }) + screen.getByRole('link', { name: folderNode2.title }), ).toBeInTheDocument(); expect( - screen.getByRole('link', { name: folderNode3.title }) + screen.getByRole('link', { name: folderNode3.title }), ).toBeInTheDocument(); expect( - screen.getByRole('link', { name: bookmarkNode1.title }) + screen.getByRole('link', { name: bookmarkNode1.title }), ).toBeInTheDocument(); expect( - screen.getByRole('link', { name: bookmarkNode4.title }) + screen.getByRole('link', { name: bookmarkNode4.title }), ).toBeInTheDocument(); expect( - screen.getByRole('link', { name: bookmarkNode5.title }) + screen.getByRole('link', { name: bookmarkNode5.title }), ).toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode2.title }) + screen.queryByRole('link', { name: bookmarkNode2.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode3.title }) + screen.queryByRole('link', { name: bookmarkNode3.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode6.title }) + screen.queryByRole('link', { name: bookmarkNode6.title }), ).not.toBeInTheDocument(); }); @@ -940,33 +940,33 @@ describe('filter active', () => { setup(); expect( - screen.getByRole('link', { name: folderNode1.title }) + screen.getByRole('link', { name: folderNode1.title }), ).toBeInTheDocument(); expect( - screen.getByRole('link', { name: bookmarkNode1.title }) + screen.getByRole('link', { name: bookmarkNode1.title }), ).toBeInTheDocument(); expect( - screen.getByRole('link', { name: bookmarkNode2.title }) + screen.getByRole('link', { name: bookmarkNode2.title }), ).toBeInTheDocument(); expect( - screen.queryByRole('link', { name: folderNode2.title }) + screen.queryByRole('link', { name: folderNode2.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: folderNode3.title }) + screen.queryByRole('link', { name: folderNode3.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode3.title }) + screen.queryByRole('link', { name: bookmarkNode3.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode4.title }) + screen.queryByRole('link', { name: bookmarkNode4.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode5.title }) + screen.queryByRole('link', { name: bookmarkNode5.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode6.title }) + screen.queryByRole('link', { name: bookmarkNode6.title }), ).not.toBeInTheDocument(); }); }); @@ -1012,33 +1012,33 @@ describe('filter active', () => { setup(); expect( - screen.getByRole('link', { name: folderNode2.title }) + screen.getByRole('link', { name: folderNode2.title }), ).toBeInTheDocument(); expect( - screen.getByRole('link', { name: bookmarkNode3.title }) + screen.getByRole('link', { name: bookmarkNode3.title }), ).toBeInTheDocument(); expect( - screen.queryByRole('link', { name: folderNode1.title }) + screen.queryByRole('link', { name: folderNode1.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: folderNode3.title }) + screen.queryByRole('link', { name: folderNode3.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode1.title }) + screen.queryByRole('link', { name: bookmarkNode1.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode2.title }) + screen.queryByRole('link', { name: bookmarkNode2.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode4.title }) + screen.queryByRole('link', { name: bookmarkNode4.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode5.title }) + screen.queryByRole('link', { name: bookmarkNode5.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode6.title }) + screen.queryByRole('link', { name: bookmarkNode6.title }), ).not.toBeInTheDocument(); }); @@ -1055,33 +1055,33 @@ describe('filter active', () => { setup(); expect( - screen.getByRole('link', { name: folderNode2.title }) + screen.getByRole('link', { name: folderNode2.title }), ).toBeInTheDocument(); expect( - screen.getByRole('link', { name: bookmarkNode3.title }) + screen.getByRole('link', { name: bookmarkNode3.title }), ).toBeInTheDocument(); expect( - screen.queryByRole('link', { name: folderNode1.title }) + screen.queryByRole('link', { name: folderNode1.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: folderNode3.title }) + screen.queryByRole('link', { name: folderNode3.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode1.title }) + screen.queryByRole('link', { name: bookmarkNode1.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode2.title }) + screen.queryByRole('link', { name: bookmarkNode2.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode4.title }) + screen.queryByRole('link', { name: bookmarkNode4.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode5.title }) + screen.queryByRole('link', { name: bookmarkNode5.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode6.title }) + screen.queryByRole('link', { name: bookmarkNode6.title }), ).not.toBeInTheDocument(); }); @@ -1097,33 +1097,33 @@ describe('filter active', () => { setup(); expect( - screen.getByRole('link', { name: folderNode2.title }) + screen.getByRole('link', { name: folderNode2.title }), ).toBeInTheDocument(); expect( - screen.getByRole('link', { name: folderNode3.title }) + screen.getByRole('link', { name: folderNode3.title }), ).toBeInTheDocument(); expect( - screen.getByRole('link', { name: bookmarkNode5.title }) + screen.getByRole('link', { name: bookmarkNode5.title }), ).toBeInTheDocument(); expect( - screen.queryByRole('link', { name: folderNode1.title }) + screen.queryByRole('link', { name: folderNode1.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode1.title }) + screen.queryByRole('link', { name: bookmarkNode1.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode2.title }) + screen.queryByRole('link', { name: bookmarkNode2.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode3.title }) + screen.queryByRole('link', { name: bookmarkNode3.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode4.title }) + screen.queryByRole('link', { name: bookmarkNode4.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode6.title }) + screen.queryByRole('link', { name: bookmarkNode6.title }), ).not.toBeInTheDocument(); }); @@ -1141,33 +1141,33 @@ describe('filter active', () => { setup(); expect( - screen.getByRole('link', { name: folderNode2.title }) + screen.getByRole('link', { name: folderNode2.title }), ).toBeInTheDocument(); expect( - screen.getByRole('link', { name: folderNode3.title }) + screen.getByRole('link', { name: folderNode3.title }), ).toBeInTheDocument(); expect( - screen.getByRole('link', { name: bookmarkNode5.title }) + screen.getByRole('link', { name: bookmarkNode5.title }), ).toBeInTheDocument(); expect( - screen.queryByRole('link', { name: folderNode1.title }) + screen.queryByRole('link', { name: folderNode1.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode1.title }) + screen.queryByRole('link', { name: bookmarkNode1.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode2.title }) + screen.queryByRole('link', { name: bookmarkNode2.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode3.title }) + screen.queryByRole('link', { name: bookmarkNode3.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode4.title }) + screen.queryByRole('link', { name: bookmarkNode4.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode6.title }) + screen.queryByRole('link', { name: bookmarkNode6.title }), ).not.toBeInTheDocument(); }); @@ -1186,33 +1186,33 @@ describe('filter active', () => { setup(); expect( - screen.getByRole('link', { name: folderNode2.title }) + screen.getByRole('link', { name: folderNode2.title }), ).toBeInTheDocument(); expect( - screen.getByRole('link', { name: folderNode3.title }) + screen.getByRole('link', { name: folderNode3.title }), ).toBeInTheDocument(); expect( - screen.getByRole('link', { name: bookmarkNode4.title }) + screen.getByRole('link', { name: bookmarkNode4.title }), ).toBeInTheDocument(); expect( - screen.getByRole('link', { name: bookmarkNode5.title }) + screen.getByRole('link', { name: bookmarkNode5.title }), ).toBeInTheDocument(); expect( - screen.queryByRole('link', { name: folderNode1.title }) + screen.queryByRole('link', { name: folderNode1.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode1.title }) + screen.queryByRole('link', { name: bookmarkNode1.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode2.title }) + screen.queryByRole('link', { name: bookmarkNode2.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode3.title }) + screen.queryByRole('link', { name: bookmarkNode3.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode6.title }) + screen.queryByRole('link', { name: bookmarkNode6.title }), ).not.toBeInTheDocument(); }); @@ -1228,33 +1228,33 @@ describe('filter active', () => { setup(); expect( - screen.getByRole('link', { name: folderNode2.title }) + screen.getByRole('link', { name: folderNode2.title }), ).toBeInTheDocument(); expect( - screen.getByRole('link', { name: bookmarkNode3.title }) + screen.getByRole('link', { name: bookmarkNode3.title }), ).toBeInTheDocument(); expect( - screen.getByRole('link', { name: bookmarkNode4.title }) + screen.getByRole('link', { name: bookmarkNode4.title }), ).toBeInTheDocument(); expect( - screen.queryByRole('link', { name: folderNode1.title }) + screen.queryByRole('link', { name: folderNode1.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: folderNode3.title }) + screen.queryByRole('link', { name: folderNode3.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode1.title }) + screen.queryByRole('link', { name: bookmarkNode1.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode2.title }) + screen.queryByRole('link', { name: bookmarkNode2.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode5.title }) + screen.queryByRole('link', { name: bookmarkNode5.title }), ).not.toBeInTheDocument(); expect( - screen.queryByRole('link', { name: bookmarkNode6.title }) + screen.queryByRole('link', { name: bookmarkNode6.title }), ).not.toBeInTheDocument(); }); }); diff --git a/test/treetop/HistoryManager.test.ts b/test/treetop/HistoryManager.test.ts index 73c0094..f15aded 100644 --- a/test/treetop/HistoryManager.test.ts +++ b/test/treetop/HistoryManager.test.ts @@ -19,7 +19,7 @@ import { } from '../utils/factories'; const getBookmarkNodes = ( - folder: Treetop.FolderNode + folder: Treetop.FolderNode, ): Treetop.BookmarkNode[] => { const bookmarkNodes = []; for (const child of folder.children) { @@ -181,7 +181,7 @@ describe('handleBookmarkCreated', () => { expect(lastVisitTimeMap.has(bookmarkNode.id)).toBe(true); expect(get(lastVisitTimeMap.get(bookmarkNode.id)!)).toBe( - visitItem.visitTime! + visitItem.visitTime!, ); }); @@ -254,7 +254,7 @@ describe('handleBookmarkChanged', () => { await historyManager.handleBookmarkChanged(bookmarkNode.id, changeInfo); expect(get(lastVisitTimeMap.get(bookmarkNode.id)!)).toBe( - visitItem.visitTime! + visitItem.visitTime!, ); }); @@ -305,10 +305,10 @@ describe('handleVisited', () => { await historyManager.handleVisited(historyItem); expect(get(lastVisitTimeMap.get(bookmarkNode1.id)!)).toBe( - historyItem.lastVisitTime! + historyItem.lastVisitTime!, ); expect(get(lastVisitTimeMap.get(bookmarkNode2.id)!)).toBe( - historyItem.lastVisitTime! + historyItem.lastVisitTime!, ); }); diff --git a/test/treetop/PageHeader.svelte.test.ts b/test/treetop/PageHeader.svelte.test.ts index 4afc293..5b8439e 100644 --- a/test/treetop/PageHeader.svelte.test.ts +++ b/test/treetop/PageHeader.svelte.test.ts @@ -22,7 +22,7 @@ it('renders page header', () => { expect(screen.getByRole('banner')).toHaveTextContent('Treetop'); expect(screen.getByRole('button', { hidden: true })).toHaveTextContent( - 'settings' + 'settings', ); }); diff --git a/test/treetop/PreferencesManager.test.ts b/test/treetop/PreferencesManager.test.ts index 80dd10a..ce4b9ea 100644 --- a/test/treetop/PreferencesManager.test.ts +++ b/test/treetop/PreferencesManager.test.ts @@ -28,7 +28,7 @@ describe('createStore', () => { const store = preferencesManager.createStore(name, value); expect(get(store)).toBe(value); - } + }, ); }); diff --git a/test/treetop/Treetop.svelte.test.ts b/test/treetop/Treetop.svelte.test.ts index 1f149c6..24c2040 100644 --- a/test/treetop/Treetop.svelte.test.ts +++ b/test/treetop/Treetop.svelte.test.ts @@ -89,13 +89,13 @@ describe('Treetop', () => { // mockBrowser.contextMenus.onShown.removeListener.expect( - expect.any(Function) + expect.any(Function), ); mockBrowser.contextMenus.onHidden.removeListener.expect( - expect.any(Function) + expect.any(Function), ); mockBrowser.contextMenus.onClicked.removeListener.expect( - expect.any(Function) + expect.any(Function), ); cleanup(); diff --git a/test/treetop/menus/DeleteMenuItem.test.ts b/test/treetop/menus/DeleteMenuItem.test.ts index 37c36be..106cf42 100644 --- a/test/treetop/menus/DeleteMenuItem.test.ts +++ b/test/treetop/menus/DeleteMenuItem.test.ts @@ -28,7 +28,7 @@ beforeEach(() => { BUILT_IN_FOLDER_INFO, nodeStoreMap, filterActive, - callback + callback, ); }); diff --git a/test/treetop/menus/MenuManager.test.ts b/test/treetop/menus/MenuManager.test.ts index 50380eb..007d106 100644 --- a/test/treetop/menus/MenuManager.test.ts +++ b/test/treetop/menus/MenuManager.test.ts @@ -12,7 +12,7 @@ let menuManager: MenuManager; class TestMenuItem extends MenuItem { constructor( onClickedCallback: OnClickedCallback, - private isEnabled: boolean + private isEnabled: boolean, ) { super(onClickedCallback); } diff --git a/test/treetop/menus/OpenAllInTabsMenuItem.test.ts b/test/treetop/menus/OpenAllInTabsMenuItem.test.ts index 2453be5..4126d1b 100644 --- a/test/treetop/menus/OpenAllInTabsMenuItem.test.ts +++ b/test/treetop/menus/OpenAllInTabsMenuItem.test.ts @@ -25,7 +25,7 @@ beforeEach(() => { menuItem = new OpenAllInTabsMenuItem( BUILT_IN_FOLDER_INFO, nodeStoreMap, - callback + callback, ); }); diff --git a/test/treetop/utils.test.ts b/test/treetop/utils.test.ts index 6367cb1..cbc176f 100644 --- a/test/treetop/utils.test.ts +++ b/test/treetop/utils.test.ts @@ -18,7 +18,7 @@ describe('truncateMiddle', () => { 'returns unmodified string if length is less than or equal to max. length: %p/%i', (str, maxLength) => { expect(truncateMiddle(str, maxLength)).toBe(str); - } + }, ); it.each([ @@ -30,6 +30,6 @@ describe('truncateMiddle', () => { 'returns $expected for $str with max. length $maxLength', ({ str, maxLength, expected }) => { expect(truncateMiddle(str, maxLength)).toBe(expected); - } + }, ); }); diff --git a/test/utils/factories.ts b/test/utils/factories.ts index 3fe2cd0..ae9b3dc 100644 --- a/test/utils/factories.ts +++ b/test/utils/factories.ts @@ -15,7 +15,7 @@ const OTHER_BOOKMARKS_GUID = 'other-bookmarks-ids'; // export const createBookmarkNode = ( - withProperties?: Partial> + withProperties?: Partial>, ): Treetop.BookmarkNode => { return { id: faker.datatype.uuid(), @@ -27,7 +27,7 @@ export const createBookmarkNode = ( }; export const createFolderNode = ( - withProperties?: Partial> + withProperties?: Partial>, ): Treetop.FolderNode => { return { id: faker.datatype.uuid(), @@ -39,7 +39,7 @@ export const createFolderNode = ( }; export const createSeparatorNode = ( - withProperties?: Partial> + withProperties?: Partial>, ): Treetop.SeparatorNode => { return { id: faker.datatype.uuid(), @@ -53,7 +53,7 @@ export const createSeparatorNode = ( // export const createBrowserBookmarkNode = ( - parent: Bookmarks.BookmarkTreeNode + parent: Bookmarks.BookmarkTreeNode, ): Bookmarks.BookmarkTreeNode => { const node: Bookmarks.BookmarkTreeNode = { id: faker.datatype.uuid(), @@ -66,7 +66,7 @@ export const createBrowserBookmarkNode = ( }; export const createBrowserFolderNode = ( - parent: Bookmarks.BookmarkTreeNode + parent: Bookmarks.BookmarkTreeNode, ): Bookmarks.BookmarkTreeNode => { const node: Bookmarks.BookmarkTreeNode = { id: faker.datatype.uuid(), @@ -79,7 +79,7 @@ export const createBrowserFolderNode = ( }; export const createBrowserSeparatorNode = ( - parent: Bookmarks.BookmarkTreeNode + parent: Bookmarks.BookmarkTreeNode, ): Bookmarks.BookmarkTreeNode => { const node: Bookmarks.BookmarkTreeNode = { id: faker.datatype.uuid(), diff --git a/test/welcome/Welcome.svelte.test.ts b/test/welcome/Welcome.svelte.test.ts index 8d14821..a1de262 100644 --- a/test/welcome/Welcome.svelte.test.ts +++ b/test/welcome/Welcome.svelte.test.ts @@ -15,9 +15,9 @@ it('renders welcome page', () => { expect(screen.getByText(/welcome to treetop/i)).toBeInTheDocument(); expect(screen.getByText(/getting started/i)).toBeInTheDocument(); expect( - screen.getByText(/open treetop by clicking its icon/i) + screen.getByText(/open treetop by clicking its icon/i), ).toBeInTheDocument(); expect( - screen.getByText(/treetop shows all your bookmarks on a single page/i) + screen.getByText(/treetop shows all your bookmarks on a single page/i), ).toBeInTheDocument(); });