TagSpaces is an offline, open source, document manager with tagging support
chore: updating fuse to 7.1.0
Ilian Sapundshievdf4c03fadfae
diff --git a/package-lock.json b/package-lock.jsonindex 0a9951e54..b1a586111 100644--- a/package-lock.json+++ b/package-lock.json@@ -37,7 +37,7 @@"find-free-ports": "3.1.1","fs-extra": "11.3.3","fscreen": "1.2.0",- "fuse.js": "6.6.2",+ "fuse.js": "7.1.0","geolocation-utils": "1.2.6","html2canvas": "1.4.1","i18next": "^23.4.6",@@ -27338,7 +27338,9 @@}},"node_modules/fuse.js": {- "version": "6.6.2",+ "version": "7.1.0",+ "resolved": "https://registry.npmjs.org/fuse.js/-/fuse.js-7.1.0.tgz",+ "integrity": "sha512-trLf4SzuuUxfusZADLINj+dE8clK1frKdmqiJNb1Es75fmI5oY6X2mxLVUciLLjxqw/xr72Dhy+lER6dGd02FQ==","license": "Apache-2.0","engines": {"node": ">=10"diff --git a/package.json b/package.jsonindex b0f7dbde2..a13f12137 100644--- a/package.json+++ b/package.json@@ -188,7 +188,7 @@"find-free-ports": "3.1.1","fs-extra": "11.3.3","fscreen": "1.2.0",- "fuse.js": "6.6.2",+ "fuse.js": "7.1.0","geolocation-utils": "1.2.6","html2canvas": "1.4.1","i18next": "^23.4.6",diff --git a/src/renderer/services/search.ts b/src/renderer/services/search.tsindex b9cfb39b6..936a59a60 100644--- a/src/renderer/services/search.ts+++ b/src/renderer/services/search.ts@@ -107,7 +107,6 @@ const fuseOptions = {threshold: 0.3,ignoreLocation: true,distance: 1000,- tokenize: true,minMatchCharLength: 2,useExtendedSearch: true,keys: [diff --git a/tests/unit/search.test.js b/tests/unit/search.test.jsindex 5438ab43a..7047bad66 100644--- a/tests/unit/search.test.js+++ b/tests/unit/search.test.js@@ -474,3 +474,49 @@ test('defaultTitle returns empty string with no filters', () => {const result = defaultTitle({});expect(result).toBe('');});++// Test: Fuse 7.1.0 compatibility - options validation+test('Fuse 7.1.0 fuseOptions are valid', () => {+ // This test validates that the Fuse options are compatible with 7.1.0+ // In 7.x, the 'tokenize' option was removed+ const validFuseOptions = {+ shouldSort: true,+ threshold: 0.3,+ ignoreLocation: true,+ distance: 1000,+ minMatchCharLength: 2,+ useExtendedSearch: true,+ keys: [+ {+ name: 'name',+ getFn: (entry) => entry.name,+ weight: 0.2,+ },+ ],+ };++ // Verify that tokenize option is NOT present (removed in 7.x)+ expect(validFuseOptions.tokenize).toBeUndefined();++ // Verify all required options are present+ expect(validFuseOptions.keys).toBeDefined();+ expect(validFuseOptions.shouldSort).toBe(true);+ expect(validFuseOptions.threshold).toBe(0.3);+ expect(validFuseOptions.useExtendedSearch).toBe(true);+});++// Test: Fuse 7.1.0 search result structure+test('Fuse 7.1.0 search results have correct structure', () => {+ // Fuse 7.x always returns results with { item, refIndex } structure+ const mockSearchResult = {+ item: { id: 1, name: 'test file' },+ refIndex: 0,+ };++ // Verify the result structure matches Fuse 7.x format+ expect(mockSearchResult.item).toBeDefined();+ expect(mockSearchResult.refIndex).toBeDefined();+ expect(mockSearchResult.item.id).toBe(1);+ expect(mockSearchResult.refIndex).toBe(0);+});+