diff --git a/.eslintrc.js b/.eslintrc.js index 81fb2d0..955800c 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -23,7 +23,6 @@ module.exports = { 'prettier/prettier': [ 'error', { - trailingComma: 'all', arrowParens: 'always', printWidth: 100, }, diff --git a/jest.config.js b/jest.config.js index 2bb9891..4c5efa4 100644 --- a/jest.config.js +++ b/jest.config.js @@ -7,6 +7,8 @@ module.exports = { // using ts-jest transform: { '^.+\\.tsx?$': 'ts-jest', + '\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': + 'jest-transform-stub', }, // Runs special logic, such as cleaning up components @@ -24,7 +26,6 @@ module.exports = { moduleNameMapper: { '^.+\\.(css|scss)$': 'identity-obj-proxy', - '\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': - '/fileMocks.js', + '^.+.(png|jpg|ttf|woff|woff2)$': 'jest-transform-stub', }, }; diff --git a/package.json b/package.json index dbf09ac..6c8da08 100644 --- a/package.json +++ b/package.json @@ -66,6 +66,7 @@ "eslint-plugin-prettier": "^3.3.1", "husky": "^3.0.5", "jest": "^26.6.3", + "jest-transform-stub": "^2.0.0", "prettier": "^2.2.1", "pretty-quick": "^1.11.1", "sass": "^1.32.2", diff --git a/src/containers/home/components/ProfileSearch.tsx b/src/containers/home/components/ProfileSearch.tsx index 7f1be6f..b4777b4 100644 --- a/src/containers/home/components/ProfileSearch.tsx +++ b/src/containers/home/components/ProfileSearch.tsx @@ -73,13 +73,11 @@ const ProfileSearch: FunctionComponent = ({ selectedVersion, onProfileCha options: SearchData[], state: FilterOptionsState ) => SearchData[] = (options, { inputValue }) => - throttle( - () => - matchSorter(options, inputValue.replaceAll(' ', ''), { - keys: ['search'], - }).slice(0, 10), - 1000 - )() || []; + throttle(() => { + return matchSorter(options, inputValue.replaceAll?.(' ', '') || inputValue, { + keys: ['search'], + }).slice(0, 10); + }, 1000)() || []; if (working) return ; diff --git a/yarn.lock b/yarn.lock index 77ab118..96cfaf3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7125,6 +7125,11 @@ jest-snapshot@^26.6.0, jest-snapshot@^26.6.2: pretty-format "^26.6.2" semver "^7.3.2" +jest-transform-stub@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/jest-transform-stub/-/jest-transform-stub-2.0.0.tgz#19018b0851f7568972147a5d60074b55f0225a7d" + integrity sha512-lspHaCRx/mBbnm3h4uMMS3R5aZzMwyNpNIJLXj4cEsV0mIUtS4IjYJLSoyjRCtnxb6RIGJ4NL2quZzfIeNhbkg== + jest-util@^26.1.0, jest-util@^26.6.0, jest-util@^26.6.2: version "26.6.2" resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-26.6.2.tgz#907535dbe4d5a6cb4c47ac9b926f6af29576cbc1"