-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
13 changed files
with
421 additions
and
28 deletions.
There are no files selected for viewing
62 changes: 62 additions & 0 deletions
62
frontend/src/components/__tests__/BookmarkListItem.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { describe, expect, it } from 'vitest' | ||
|
||
import BookmarkListItem from '@/components/BookmarkListItem.vue' | ||
import { setupMountedComponents } from '@/lib/test-utils' | ||
import { StoreState } from '@/stores/misc' | ||
|
||
describe.concurrent('BookmarkListItem.vue', () => { | ||
it('renders information with StoreState Active', async () => { | ||
const { wrapper } = await setupMountedComponents( | ||
{ component: BookmarkListItem, template: false }, | ||
{ | ||
props: { | ||
type: 'seqvar', | ||
id: 'HGNC:1100' | ||
}, | ||
initialStoreState: { | ||
bookmarks: { | ||
bookmarks: [ | ||
{ | ||
user: '2c0a153e-5e8c-11ee-8c99-0242ac120002', | ||
obj_type: 'seqvar', | ||
obj_id: 'HGNC:1100', | ||
id: '2c0a153e-5e8c-11ee-8c99-0242ac120001' | ||
} | ||
], | ||
storeState: StoreState.Active | ||
} | ||
} | ||
} | ||
) | ||
|
||
expect(wrapper.text()).toContain('Bookmark') | ||
expect(wrapper.text()).not.toContain('Bookmark available after login') | ||
}) | ||
|
||
it('renders information with StoreState Error', async () => { | ||
const { wrapper } = await setupMountedComponents( | ||
{ component: BookmarkListItem, template: false }, | ||
{ | ||
props: { | ||
type: 'seqvar', | ||
id: 'HGNC:1100' | ||
}, | ||
initialStoreState: { | ||
bookmarks: { | ||
bookmarks: [ | ||
{ | ||
user: '2c0a153e-5e8c-11ee-8c99-0242ac120002', | ||
obj_type: 'seqvar', | ||
obj_id: 'HGNC:1100', | ||
id: '2c0a153e-5e8c-11ee-8c99-0242ac120001' | ||
} | ||
], | ||
storeState: StoreState.Error | ||
} | ||
} | ||
} | ||
) | ||
|
||
expect(wrapper.text()).toContain('Bookmarks available after login') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
frontend/src/components/__tests__/StrucvarDetails/AcmgRatingCard/CnGain.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { describe, expect, it } from 'vitest' | ||
|
||
import * as CurrentSV from '@/assets/__tests__/ExampleSV.json' | ||
import CnGain from '@/components/StrucvarDetails/AcmgRatingCard/CnGain.vue' | ||
import { setupMountedComponents } from '@/lib/test-utils' | ||
|
||
describe.concurrent('CnGain', async () => { | ||
it('renders the CnGain info', async () => { | ||
const { wrapper } = await setupMountedComponents( | ||
{ component: CnGain, template: false }, | ||
{ | ||
props: { | ||
showConflictingSections: false | ||
}, | ||
initialStoreState: { | ||
svAcmgRating: { | ||
svRecord: JSON.parse(JSON.stringify(CurrentSV)) | ||
} | ||
} | ||
} | ||
) | ||
|
||
const table = wrapper.findComponent({ name: 'VTable' }) | ||
expect(table.exists()).toBe(true) | ||
expect(wrapper.text()).toContain('Evidence') | ||
expect(wrapper.text()).toContain('Description') | ||
expect(wrapper.text()).toContain('Suggested points') | ||
expect(wrapper.text()).toContain('Max score') | ||
}) | ||
}) |
30 changes: 30 additions & 0 deletions
30
frontend/src/components/__tests__/StrucvarDetails/AcmgRatingCard/CnLoss.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { describe, expect, it } from 'vitest' | ||
|
||
import * as CurrentSV from '@/assets/__tests__/ExampleSV.json' | ||
import CnLoss from '@/components/StrucvarDetails/AcmgRatingCard/CnLoss.vue' | ||
import { setupMountedComponents } from '@/lib/test-utils' | ||
|
||
describe.concurrent('CnLoss', async () => { | ||
it('renders the CnLoss info', async () => { | ||
const { wrapper } = await setupMountedComponents( | ||
{ component: CnLoss, template: false }, | ||
{ | ||
props: { | ||
showConflictingSections: false | ||
}, | ||
initialStoreState: { | ||
svAcmgRating: { | ||
svRecord: JSON.parse(JSON.stringify(CurrentSV)) | ||
} | ||
} | ||
} | ||
) | ||
|
||
const table = wrapper.findComponent({ name: 'VTable' }) | ||
expect(table.exists()).toBe(true) | ||
expect(wrapper.text()).toContain('Evidence') | ||
expect(wrapper.text()).toContain('Description') | ||
expect(wrapper.text()).toContain('Suggested points') | ||
expect(wrapper.text()).toContain('Max score') | ||
}) | ||
}) |
28 changes: 28 additions & 0 deletions
28
frontend/src/components/__tests__/StrucvarDetails/AcmgRatingCard/SummarySheet.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { describe, expect, it } from 'vitest' | ||
|
||
import SummarySheet from '@/components/StrucvarDetails/AcmgRatingCard/SummarySheet.vue' | ||
import { setupMountedComponents } from '@/lib/test-utils' | ||
|
||
describe.concurrent('SummarySheet', async () => { | ||
it('renders the SummarySheet info', async () => { | ||
const { wrapper } = await setupMountedComponents( | ||
{ component: SummarySheet, template: false }, | ||
{ | ||
props: { | ||
calculatedAcmgClass: 'Pathogenic', | ||
calculatedAcmgScore: 3 | ||
} | ||
} | ||
) | ||
|
||
expect(wrapper.text()).toContain('Semi-Automated ACMG Pathogenicity Prediction') | ||
const sheet = wrapper.findComponent({ name: 'VSheet' }) | ||
expect(sheet.exists()).toBe(true) | ||
|
||
// Buttons | ||
const buttons = wrapper.findAllComponents({ name: 'VBtn' }) | ||
expect(buttons.length).toBe(2) | ||
expect(buttons[0].text()).toContain('Reset to Auto') | ||
expect(buttons[1].text()).toContain('Documentation') | ||
}) | ||
}) |
17 changes: 15 additions & 2 deletions
17
frontend/src/components/__tests__/StrucvarDetails/ClinvarCard.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,27 @@ | ||
import { describe, expect, it } from 'vitest' | ||
|
||
import * as CurrentSV from '@/assets/__tests__/ExampleSV.json' | ||
import ClinvarCard from '@/components/StrucvarDetails/ClinvarCard.vue' | ||
import { setupMountedComponents } from '@/lib/test-utils' | ||
|
||
describe.concurrent('ClinvarCard', async () => { | ||
it('renders the ClinvarCard info', async () => { | ||
const { wrapper } = await setupMountedComponents( | ||
{ component: ClinvarCard, template: false }, | ||
{} | ||
{ | ||
props: { | ||
genomeRelease: 'grch37' | ||
}, | ||
initialStoreState: { | ||
svInfo: { | ||
currentSvRecord: JSON.parse(JSON.stringify(CurrentSV)) | ||
} | ||
} | ||
} | ||
) | ||
expect(wrapper.exists()).toBe(true) | ||
|
||
expect(wrapper.text()).toContain('ClinVar') | ||
const dataTable = wrapper.findComponent({ name: 'VDataTable' }) | ||
expect(dataTable.exists()).toBe(true) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
frontend/src/components/__tests__/StrucvarDetails/GeneListCard/GeneDosage.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { describe, expect, it } from 'vitest' | ||
|
||
import GeneDosage from '@/components/StrucvarDetails/GeneListCard/GeneDosage.vue' | ||
import { setupMountedComponents } from '@/lib/test-utils' | ||
|
||
describe.concurrent('GeneDosage', async () => { | ||
it('renders the GeneDosage info with CLINGEN_DOSAGE_SCORE_RECESSIVE', async () => { | ||
const { wrapper } = await setupMountedComponents( | ||
{ component: GeneDosage, template: false }, | ||
{ | ||
props: { | ||
geneSymbol: 'BRCA1', | ||
dosage: 'CLINGEN_DOSAGE_SCORE_RECESSIVE' | ||
} | ||
} | ||
) | ||
|
||
expect(wrapper.text()).toContain('AR') | ||
const launchButton = wrapper.findComponent({ name: 'VIcon' }) | ||
expect(launchButton.exists()).toBe(true) | ||
}) | ||
|
||
it('renders the GeneDosage info with CLINGEN_DOSAGE_SCORE_UNKNOWN', async () => { | ||
const { wrapper } = await setupMountedComponents( | ||
{ component: GeneDosage, template: false }, | ||
{ | ||
props: { | ||
geneSymbol: 'BRCA1', | ||
dosage: 'CLINGEN_DOSAGE_SCORE_UNKNOWN' | ||
} | ||
} | ||
) | ||
|
||
expect(wrapper.text()).toContain('N/A') | ||
}) | ||
|
||
it('renders the GeneDosage info with CLINGEN_DOSAGE_SCORE_SUFFICIENT_EVIDENCE_AVAILABLE', async () => { | ||
const { wrapper } = await setupMountedComponents( | ||
{ component: GeneDosage, template: false }, | ||
{ | ||
props: { | ||
geneSymbol: 'BRCA1', | ||
dosage: 'CLINGEN_DOSAGE_SCORE_SUFFICIENT_EVIDENCE_AVAILABLE' | ||
} | ||
} | ||
) | ||
|
||
expect(wrapper.text()).toContain('3') | ||
const launchButton = wrapper.findComponent({ name: 'VIcon' }) | ||
expect(launchButton.exists()).toBe(true) | ||
}) | ||
}) |
25 changes: 25 additions & 0 deletions
25
frontend/src/components/__tests__/StrucvarDetails/GeneListCard/GeneListEntry.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { describe, expect, it } from 'vitest' | ||
|
||
import * as BRCA1GeneInfo from '@/assets/__tests__/BRCA1GeneInfo.json' | ||
import GeneListEntry from '@/components/StrucvarDetails/GeneListCard/GeneListEntry.vue' | ||
import { setupMountedComponents } from '@/lib/test-utils' | ||
|
||
describe.concurrent('GeneListEntry', async () => { | ||
it('renders the GeneListEntry info', async () => { | ||
const { wrapper } = await setupMountedComponents( | ||
{ component: GeneListEntry, template: false }, | ||
{ | ||
props: { | ||
item: JSON.parse(JSON.stringify({ raw: BRCA1GeneInfo['genes']['HGNC:1100'] })), | ||
isSelected: false | ||
} | ||
} | ||
) | ||
|
||
expect(wrapper.text()).toContain('BRCA1') | ||
const dosage = wrapper.findComponent({ name: 'GeneDosage' }) | ||
expect(dosage.exists()).toBe(true) | ||
const scoreChip = wrapper.findComponent({ name: 'ScoreChip' }) | ||
expect(scoreChip.exists()).toBe(true) | ||
}) | ||
}) |
34 changes: 34 additions & 0 deletions
34
frontend/src/components/__tests__/StrucvarDetails/GeneListCard/ScoreChip.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { describe, expect, it } from 'vitest' | ||
|
||
import ScoreChip from '@/components/StrucvarDetails/GeneListCard/ScoreChip.vue' | ||
import { setupMountedComponents } from '@/lib/test-utils' | ||
|
||
describe.concurrent('ScoreChip', async () => { | ||
it('renders the ScoreChip info with specified link', async () => { | ||
const { wrapper } = await setupMountedComponents( | ||
{ component: ScoreChip, template: false }, | ||
{ | ||
props: { | ||
value: 0, | ||
hrefUrl: 'https://example.com' | ||
} | ||
} | ||
) | ||
|
||
expect(wrapper.text()).toContain('0') | ||
}) | ||
|
||
it('renders the ScoreChip info without link', async () => { | ||
const { wrapper } = await setupMountedComponents( | ||
{ component: ScoreChip, template: false }, | ||
{ | ||
props: { | ||
value: 0, | ||
hrefUrl: '' | ||
} | ||
} | ||
) | ||
|
||
expect(wrapper.text()).toContain('0') | ||
}) | ||
}) |
Oops, something went wrong.