Skip to content

Commit

Permalink
Add test for refined IGV metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
eweitz committed Jan 3, 2025
1 parent 4fe169d commit be89b68
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions src/components/IGVFileSelector.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getValidIgvFiles, getValidIgvFilesFromAttributeValues, isDrsUri } from 'src/components/IGVFileSelector';
import { getIgvMetricDetails, getValidIgvFiles, getValidIgvFilesFromAttributeValues, isDrsUri } from 'src/components/IGVFileSelector';
import { DrsUriResolver } from 'src/libs/ajax/drs/DrsUriResolver';
import { isFeaturePreviewEnabled } from 'src/libs/feature-previews';

Expand Down Expand Up @@ -243,7 +243,7 @@ describe('getValidIgvFilesFromAttributeValues', () => {
});

it('calls to resolve access URLs when two DRS URIs are found', async () => {
// An IGV selection must have a file (e.g. VCF) and an index file (TBI)
// An IGV selection generally must have a file (e.g. VCF) and an index file (TBI)
const fileDrsUri = 'drs://dg.4503:2802a94d-f540-499f-950a-db3c2a9f2dc4';
const indexFileDrsUri = 'drs://dg.4503:2802a94d-f540-499f-950a-11111111111';
const fileName = 'foo.vcf.gz';
Expand Down Expand Up @@ -290,4 +290,31 @@ describe('getValidIgvFilesFromAttributeValues', () => {
},
]);
});

it('provides relevant component-specific logging metrics', async () => {
const selectedFiles = [
{
filePath: 'https://bucket/[email protected]&userProject=my-billing-project&signature=secret',
indexFilePath: 'https://bucket/[email protected]&userProject=my-billing-project&signature=secret',
isSignedUrl: true,
},
{
filePath: 'gs://datarepo-dev-ab123456-bucket/cae37a2a-657f-4b04-9fef-59c215020078/5f5f634d-70f3-4914-9c71-9d14c7f98e60/test.bam',
indexFilePath: 'gs://datarepo-dev-ab123456-bucket/cae37a2a-657f-4b04-9fef-59c215020078/2eeff61f-ae9e-41ae-bb40-909ff6bdfba8/test.bam.bai',
isSignedUrl: false,
},
];

const refGenome = { genome: 'hg38' };

const igvDetails = getIgvMetricDetails(selectedFiles, refGenome);

expect(igvDetails).toEqual({
igvNumTracks: 2,
igvFileExtensions: ['vcf.gz', 'bam'],
igvIndexExtensions: ['gz.tbi', 'bam.bai'],
igvHasDrsUris: true,
igvGenome: 'hg38',
});
});
});

0 comments on commit be89b68

Please sign in to comment.