Skip to content

Commit

Permalink
remove DUT controls from download
Browse files Browse the repository at this point in the history
  • Loading branch information
fhennig committed Feb 4, 2025
1 parent e39de96 commit 09676fe
Showing 1 changed file with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,19 @@ const defaultOrganism = 'ebola';
async function renderDialog({
downloadParams = new SelectFilter(new Set()),
allowSubmissionOfConsensusSequences = true,
dataUseTermsEnabled = true,
}: {
downloadParams?: SequenceFilter;
allowSubmissionOfConsensusSequences?: boolean;
dataUseTermsEnabled?: boolean;
} = {}) {
render(
<DownloadDialog
downloadUrlGenerator={new DownloadUrlGenerator(defaultOrganism, defaultLapisUrl)}
downloadUrlGenerator={new DownloadUrlGenerator(defaultOrganism, defaultLapisUrl, dataUseTermsEnabled)}
sequenceFilter={downloadParams}
referenceGenomesSequenceNames={defaultReferenceGenome}
allowSubmissionOfConsensusSequences={allowSubmissionOfConsensusSequences}
dataUseTermsEnabled={dataUseTermsEnabled}
/>,
);

Expand Down Expand Up @@ -139,6 +142,27 @@ describe('DownloadDialog', () => {
expect(screen.getByLabelText(olderVersionsLabel)).toBeInTheDocument();
expect(screen.getByLabelText(gzipCompressionLabel)).toBeInTheDocument();
});

describe('DataUseTerms disabled', () => {
test('download button activated by default', async () => {
await renderDialog({ dataUseTermsEnabled: false });

const downloadButton = screen.getByRole('link', { name: 'Download' });
expect(downloadButton).not.toHaveClass('btn-disabled');
});

test('checkbox not in the document', async () => {
await renderDialog({ dataUseTermsEnabled: false });

expect(screen.queryByLabelText('I agree to the data use terms.')).not.toBeInTheDocument();
});

test('restricted data switch is not in the document', async () => {
await renderDialog({ dataUseTermsEnabled: false });

expect(screen.queryByLabelText(/restricted data/)).not.toBeInTheDocument();
});
});
});

async function checkAgreement() {
Expand Down

0 comments on commit 09676fe

Please sign in to comment.