-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(teamProjectsHeader): Added working storybook
- Loading branch information
1 parent
934e73b
commit fc7f757
Showing
4 changed files
with
166 additions
and
60 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
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
92 changes: 92 additions & 0 deletions
92
src/Analysis/SharedUtils/TeamProject/TeamProjectModal/TeamProjectModal.stories.jsx
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,92 @@ | ||
import React from 'react'; | ||
import TeamProjectModal from './TeamProjectModal'; | ||
import { QueryClient, QueryClientProvider } from 'react-query'; | ||
import { rest } from 'msw'; | ||
|
||
export default { | ||
title: 'TESTS1/SharedUtils/TeamProjectModal', | ||
component: TeamProjectModal, | ||
}; | ||
|
||
const mockedQueryClient = new QueryClient({ | ||
defaultOptions: { | ||
queries: { retry: false }, | ||
}, | ||
}); | ||
|
||
const Template = (args) => ( | ||
<div className='GWASApp'> | ||
<QueryClientProvider client={mockedQueryClient} contextSharing> | ||
<TeamProjectModal {...args} /> | ||
</QueryClientProvider> | ||
, | ||
</div> | ||
); | ||
|
||
export const MockedFailureNoUserAccess = Template.bind({}); | ||
MockedFailureNoUserAccess.args = { | ||
isModalOpen: true, | ||
setIsModalOpen: () => false, | ||
setBannerText: () => 'new banner text ' + Math.random, | ||
}; | ||
|
||
export const MockedSuccess = Template.bind({}); | ||
MockedSuccess.args = { | ||
isModalOpen: true, | ||
setIsModalOpen: () => false, | ||
setBannerText: () => 'new banner text ' + Math.random, | ||
}; | ||
/* | ||
MockedSuccess.parameters = { | ||
msw: { | ||
handlers: [ | ||
rest.get(`http://localhost/authz/mapping`, (req, res, ctx) => { | ||
const { argowrapperpath } = req.params; | ||
return res( | ||
ctx.delay(3000), | ||
ctx.json({ | ||
"teams": [ | ||
{ "teamName": '/gwas_projects/project1' }, | ||
{ "teamName": '/gwas_projects/project2' }, | ||
], | ||
}) | ||
); | ||
}), | ||
], | ||
}, | ||
}; | ||
*/ | ||
MockedSuccess.parameters = { | ||
msw: { | ||
handlers: [ | ||
rest.get( | ||
'http://:arboristapi/authz/mapping', | ||
(req, res, ctx) => { | ||
return res( | ||
ctx.delay(1000), | ||
ctx.json({ | ||
"/gwas_projects/project11": [ | ||
{ | ||
"service": "atlas-argo-wrapper-and-cohort-middleware", | ||
"method": "access" | ||
} | ||
], | ||
"/gwas_projects/project22": [ | ||
{ | ||
"service": "atlas-argo-wrapper-and-cohort-middleware", | ||
"method": "access" | ||
} | ||
], | ||
"/somethingelse": [ | ||
{ | ||
"service": "requestor", | ||
"method": "create" | ||
} | ||
], | ||
}) | ||
); | ||
} | ||
), | ||
], | ||
}, | ||
}; |
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