diff --git a/src/Analysis/Analysis.jsx b/src/Analysis/Analysis.jsx index d30e65eca4..fdce5e70fa 100644 --- a/src/Analysis/Analysis.jsx +++ b/src/Analysis/Analysis.jsx @@ -5,7 +5,7 @@ import { QueryClient, QueryClientProvider } from 'react-query'; import { analysisApps } from '../localconf'; import AppCard from './AppCard'; import TeamProjectHeader from './SharedUtils/TeamProject/TeamProjectHeader/TeamProjectHeader'; -import CheckForTeamProjectApplication from './SharedUtils/TeamProject/CheckForTeamProjectApplication'; +import CheckForTeamProjectApplication from './SharedUtils/TeamProject/Utils/CheckForTeamProjectApplication'; import './Analysis.less'; class Analysis extends React.Component { diff --git a/src/Analysis/SharedUtils/TeamProject/TeamProjectModal/TeamProjectModal.jsx b/src/Analysis/SharedUtils/TeamProject/TeamProjectModal/TeamProjectModal.jsx index bf6f2d650c..b1d1a61c40 100644 --- a/src/Analysis/SharedUtils/TeamProject/TeamProjectModal/TeamProjectModal.jsx +++ b/src/Analysis/SharedUtils/TeamProject/TeamProjectModal/TeamProjectModal.jsx @@ -6,7 +6,7 @@ import { import { useQuery } from 'react-query'; import queryConfig from '../../QueryConfig'; import LoadingErrorMessage from '../../LoadingErrorMessage/LoadingErrorMessage'; -import fetchArboristTeamProjectRoles from '../../teamProjectApi'; +import fetchArboristTeamProjectRoles from '../Utils/teamProjectApi'; import './TeamProjectModal.css'; const TeamProjectModal = ({ isModalOpen, setIsModalOpen, setBannerText }) => { diff --git a/src/Analysis/SharedUtils/TeamProject/CheckForTeamProjectApplication.js b/src/Analysis/SharedUtils/TeamProject/Utils/CheckForTeamProjectApplication.js similarity index 100% rename from src/Analysis/SharedUtils/TeamProject/CheckForTeamProjectApplication.js rename to src/Analysis/SharedUtils/TeamProject/Utils/CheckForTeamProjectApplication.js diff --git a/src/Analysis/SharedUtils/TeamProject/Utils/CheckForTeamProjectApplication.test.js b/src/Analysis/SharedUtils/TeamProject/Utils/CheckForTeamProjectApplication.test.js new file mode 100644 index 0000000000..bb213943d5 --- /dev/null +++ b/src/Analysis/SharedUtils/TeamProject/Utils/CheckForTeamProjectApplication.test.js @@ -0,0 +1,27 @@ +import CheckForTeamProjectApplication from './CheckForTeamProjectApplication'; + +describe('CheckForTeamProjectApplication', () => { + it('should return true if the analysisApps contain a team project application', () => { + const analysisApps = { + 'OHDSI Atlas': 1, + 'SomeOtherApp': 2, + }; + const result = CheckForTeamProjectApplication(analysisApps); + expect(result).toBe(true); + }); + + it('should return false if the analysisApps do not contain any team project application', () => { + const analysisApps = { + 'SomeOtherApp': 1, + 'AnotherApp': 2, + }; + const result = CheckForTeamProjectApplication(analysisApps); + expect(result).toBe(false); + }); + + it('should return false for an empty analysisApps object', () => { + const analysisApps = {}; + const result = CheckForTeamProjectApplication(analysisApps); + expect(result).toBe(false); + }); +}); diff --git a/src/Analysis/SharedUtils/teamProjectApi.js b/src/Analysis/SharedUtils/TeamProject/Utils/teamProjectApi.js similarity index 91% rename from src/Analysis/SharedUtils/teamProjectApi.js rename to src/Analysis/SharedUtils/TeamProject/Utils/teamProjectApi.js index 82eee3f713..09e2c90ccd 100644 --- a/src/Analysis/SharedUtils/teamProjectApi.js +++ b/src/Analysis/SharedUtils/TeamProject/Utils/teamProjectApi.js @@ -1,4 +1,4 @@ -import { authzMappingPath } from '../../configs'; +import { authzMappingPath } from '../../../../configs'; const fetchAuthorizationMappingsForCurrentUser = async () => { const response = await fetch(authzMappingPath); diff --git a/src/Analysis/SharedUtils/teamProjectApi.test.js b/src/Analysis/SharedUtils/TeamProject/Utils/teamProjectApi.test.js similarity index 100% rename from src/Analysis/SharedUtils/teamProjectApi.test.js rename to src/Analysis/SharedUtils/TeamProject/Utils/teamProjectApi.test.js