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 @@ diff --git a/frontend/src/views/__tests__/AboutView.spec.ts b/frontend/src/views/__tests__/AboutView.spec.ts index bdf99e39..a5e77c07 100644 --- a/frontend/src/views/__tests__/AboutView.spec.ts +++ b/frontend/src/views/__tests__/AboutView.spec.ts @@ -66,5 +66,7 @@ describe.concurrent('AboutView', async () => { const mainContent = wrapper.find('.about-view') expect(mainContent.exists()).toBe(true) expect(mainContent.html()).toMatch('REEV: Explanation and Evaluation of Variants') + expect(mainContent.html()).toMatch('ClinVar is a freely accessible, public archive') + expect(mainContent.html()).toMatch('Coral emoji from OpenMoji') }) })