Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gromdimon committed Aug 30, 2023
1 parent f992523 commit 61e5f88
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
6 changes: 5 additions & 1 deletion frontend/src/views/__tests__/GeneDetailView.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ describe('GeneDetailView', async () => {
const wrapper = makeWrapper()

const navigationDrawer = wrapper.find('.v-navigation-drawer')
expect(navigationDrawer.exists()).toBe(true)

const hgnc = wrapper.find('#hgnc')
const constraintsScores = wrapper.find('#constraints-scores')
const ncbiSummary = wrapper.find('#ncbi-summary')
Expand All @@ -89,7 +91,6 @@ describe('GeneDetailView', async () => {
const acmgList = wrapper.find('#acmg-list')
const geneRifs = wrapper.find('#gene-rifs')
const locusSpecificDatabases = wrapper.find('#locus-specific-databases')
expect(navigationDrawer.exists()).toBe(true)
expect(hgnc.exists()).toBe(true)
expect(constraintsScores.exists()).toBe(true)
expect(ncbiSummary.exists()).toBe(true)
Expand All @@ -99,5 +100,8 @@ describe('GeneDetailView', async () => {
expect(acmgList.exists()).toBe(true)
expect(geneRifs.exists()).toBe(true)
expect(locusSpecificDatabases.exists()).toBe(true)

const launchImage = wrapper.findAll('.mdi-launch')
expect(launchImage.length).toBe(14)
})
})
17 changes: 15 additions & 2 deletions frontend/src/views/__tests__/HomeView.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,22 @@ describe('HomeView with mocked router', async () => {
expect(subtitle.exists()).toBe(true)
expect(exampleTerms.length).toBe(6)
})
})

describe('HomeView with real router', async () => {
it('uses example by click', async () => {
const wrapper = makeWrapper(router)
const store = useGeneInfoStore()
store.storeState = StoreState.Active
store.geneSymbol = geneData.geneSymbol
store.geneInfo = JSON.parse(JSON.stringify(geneData.geneInfo))

const exampleTerm = wrapper.find('.example')
expect(exampleTerm.exists()).toBe(true)
expect(exampleTerm.text()).toBe('BRCA1')
await exampleTerm.trigger('click')
await nextTick()
expect(store.geneSymbol).toBe('BRCA1')
})

it('renders correctly uses the router', async () => {
const wrapper = makeWrapper(router)
const store = useGeneInfoStore()
Expand Down

0 comments on commit 61e5f88

Please sign in to comment.