-
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
46 changed files
with
2,045 additions
and
266 deletions.
There are no files selected for viewing
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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,43 @@ | ||
import { beforeEach, describe, it, expect, vi } from 'vitest' | ||
import createFetchMock from 'vitest-fetch-mock' | ||
|
||
import { MehariClient } from '../mehari' | ||
import * as BRCA1TxInfo from '@/assets/__tests__/BRCA1TxInfo.json' | ||
|
||
const fetchMocker = createFetchMock(vi) | ||
|
||
describe.concurrent('Mehari Client', () => { | ||
beforeEach(() => { | ||
fetchMocker.enableMocks() | ||
fetchMocker.resetMocks() | ||
}) | ||
|
||
it('fetches TxCsq info correctly', async () => { | ||
fetchMocker.mockResponseOnce(JSON.stringify(BRCA1TxInfo)) | ||
|
||
const client = new MehariClient() | ||
const result = await client.retrieveTxCsq('grch37', 'chr17', 43044295, 'A', 'G', 'HGNC:1100') | ||
expect(JSON.stringify(result)).toEqual(JSON.stringify(BRCA1TxInfo)) | ||
}) | ||
|
||
it('fetches TxCsq info correctly without HGNC id', async () => { | ||
fetchMocker.mockResponseOnce(JSON.stringify(BRCA1TxInfo)) | ||
|
||
const client = new MehariClient() | ||
const result = await client.retrieveTxCsq('grch37', 'chr17', 43044295, 'A', 'G') | ||
expect(JSON.stringify(result)).toEqual(JSON.stringify(BRCA1TxInfo)) | ||
}) | ||
|
||
it('fails to fetch variant info with wrong variant', async () => { | ||
fetchMocker.mockResponse((req) => { | ||
if (req.url.includes('alternative=G')) { | ||
return Promise.resolve(JSON.stringify(BRCA1TxInfo)) | ||
} | ||
return Promise.resolve(JSON.stringify({ status: 400 })) | ||
}) | ||
|
||
const client = new MehariClient() | ||
const result = await client.retrieveTxCsq('grch37', 'chr17', 43044295, 'A', 'T') | ||
expect(JSON.stringify(result)).toEqual(JSON.stringify({ status: 400 })) | ||
}) | ||
}) |
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
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
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Oops, something went wrong.