diff --git a/__tests__/jestSetupFile.js b/__tests__/jestSetupFile.js index 56cbf5c54..8e0939f08 100644 --- a/__tests__/jestSetupFile.js +++ b/__tests__/jestSetupFile.js @@ -146,3 +146,7 @@ jest.mock('cozy-pouch-link', () => { jest.mock('react-native-mail', () => ({ mail: jest.fn() })) + +jest.mock('/app/domain/search/dataproxy-wrapper', () => ({ + SearchEngine: jest.fn() +})) diff --git a/src/app/domain/search/dataproxy-wrapper.ts b/src/app/domain/search/dataproxy-wrapper.ts new file mode 100644 index 000000000..63cd4434e --- /dev/null +++ b/src/app/domain/search/dataproxy-wrapper.ts @@ -0,0 +1,5 @@ +// We cannot use `cozy-dataproxy-lib/api` here due to our bundler configuration +// even if it is declared in the package.json file. Instead we should target the +// 'dist' directory. +// In the future we should find a way to homogenize bundlers configuration. +export { SearchEngine } from 'cozy-dataproxy-lib/dist/api' diff --git a/src/app/domain/search/search.ts b/src/app/domain/search/search.ts index d85aa00d7..86df5d9ac 100644 --- a/src/app/domain/search/search.ts +++ b/src/app/domain/search/search.ts @@ -1,10 +1,9 @@ import CozyClient from 'cozy-client' -// We cannot use `cozy-dataproxy-lib/api` here due to our bundler configuration. -// In the future we should find a way to homogenize bundlers configuration. -import { SearchEngine } from 'cozy-dataproxy-lib/dist/api' import type { SearchOptions } from 'cozy-dataproxy-lib/dist/search/types' import Minilog from 'cozy-minilog' +import { SearchEngine } from '/app/domain/search/dataproxy-wrapper' + const log = Minilog('📱🗂️ Search') let searchEngine: SearchEngine | undefined = undefined