diff --git a/frontend/src/api/__tests__/utils.spec.ts b/frontend/src/api/__tests__/utils.spec.ts index c0df52ca..13f2b3ac 100644 --- a/frontend/src/api/__tests__/utils.spec.ts +++ b/frontend/src/api/__tests__/utils.spec.ts @@ -159,5 +159,20 @@ describe('infoFromQuery method', () => { alternative: undefined, hgnc_id: undefined }) + + it('should return null if no entry', () => { + const result = search('', 'foo37') + expect(result).toBe(null) + }) + + it('should remove whitespace', () => { + const result = search(' HGNC:1100 ', 'ghcr37') + expect(result).toEqual({ + name: 'gene', + params: { + searchTerm: 'HGNC:1100', + genomeRelease: 'ghcr37' + } + }) }) }) diff --git a/frontend/src/api/utils.ts b/frontend/src/api/utils.ts index f93f23d7..ab5a9319 100644 --- a/frontend/src/api/utils.ts +++ b/frontend/src/api/utils.ts @@ -132,6 +132,11 @@ export const search = (searchTerm: string, genomeRelease: string) => { ] for (const [regexp, getRoute] of SEARCH_REGEXPS) { + // Remove trailing whitespace + searchTerm = searchTerm.trim() + if (!searchTerm) { + return null + } if (regexp.test(searchTerm)) { const routeLocation = getRoute() console.log(`term ${searchTerm} matched ${regexp}, route is`, routeLocation) diff --git a/frontend/src/views/AboutView.vue b/frontend/src/views/AboutView.vue index c738195e..6cee4ea5 100644 --- a/frontend/src/views/AboutView.vue +++ b/frontend/src/views/AboutView.vue @@ -1,5 +1,23 @@ @@ -21,6 +39,25 @@ import HeaderDefault from '@/components/HeaderDefault.vue'
+
+