Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: adjust CustomDichotomousCovariates storybook to component's interface #1237

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { QueryClient, QueryClientProvider } from 'react-query';
import { rest } from 'msw';
import ContinuousCovariates from './ContinuousCovariates';
import { SourceContextProvider } from '../../Utils/Source';
import './Covariates.css';

export default {
title: 'Tests3/GWASV2/ContinuousCovariates',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,24 @@ const studyPopulationCohort = {
size: 400000,
};

export const SuccessCase = Template.bind({});
SuccessCase.args = {
export const SuccessAndZeroOverlapCases = Template.bind({});
SuccessAndZeroOverlapCases.args = {
dispatch: (payload) => {
console.log('dummy dispatch', payload);
},
setMode: (mode) => {
console.log('dummy setMode', mode);
handleSelect: (selectedPair) => {
console.log('dummy handleSelect', selectedPair);
},
handleClose: () => {
console.log('dummy handleClose');
},
type: 'outcome',
studyPopulationCohort: studyPopulationCohort,
covariates: [],
outcome: null,
submitButtonLabel: 'Submit!!'
pieterlukasse marked this conversation as resolved.
Show resolved Hide resolved
};
SuccessCase.parameters = {
const dummyNoOverlapCohortId = 30001;
SuccessAndZeroOverlapCases.parameters = {
// msw mocking:
msw: {
handlers: [
Expand All @@ -48,11 +52,17 @@ SuccessCase.parameters = {
const { cohortmiddlewarepath } = req.params;
const { cohortdefinitionA } = req.params;
const { cohortdefinitionB } = req.params;
// default random overlap:
let overlap = Math.floor(Math.random() * 10000) + 10000;
if (parseInt(cohortdefinitionA) === dummyNoOverlapCohortId || parseInt(cohortdefinitionB) === dummyNoOverlapCohortId) {
// set overlap to 0 to trigger a validation scenario in the component:
overlap = 0;
}
return res(
ctx.delay(500),
ctx.json({
cohort_overlap: {
case_control_overlap: Math.floor(Math.random() * 10000) + 10000,
case_control_overlap: overlap,
}, // because of random here, we get some data that does not really make sense...SuccessCase2 tries to fix that for some of the relevant group overlaps...
})
);
Expand All @@ -79,8 +89,8 @@ SuccessCase.parameters = {
size: 212000,
},
{
cohort_definition_id: 301,
cohort_name: 'Mock cohortB - medium',
cohort_definition_id: dummyNoOverlapCohortId,
cohort_name: 'NO OVERLAP Mock cohortB - medium',
size: 55296,
},
{
Expand Down