-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update projects empty state page and Launch Jupyter button (#3173)
- Loading branch information
1 parent
39b023e
commit 2e37911
Showing
11 changed files
with
408 additions
and
50 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
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
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
53 changes: 53 additions & 0 deletions
53
frontend/src/pages/projects/screens/projects/__tests__/EmptyProjects.spec.tsx
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,53 @@ | ||
import React from 'react'; | ||
import { act, render, screen } from '@testing-library/react'; | ||
import '@testing-library/jest-dom'; | ||
import EmptyProjects from '~/pages/projects/screens/projects/EmptyProjects'; | ||
import { useUser } from '~/redux/selectors'; | ||
|
||
jest.mock('~/app/AppContext', () => ({ | ||
__esModule: true, | ||
useAppContext: jest.fn(), | ||
})); | ||
|
||
jest.mock('~/redux/selectors', () => ({ | ||
...jest.requireActual('~/redux/selectors'), | ||
useUser: jest.fn(), | ||
useClusterInfo: jest.fn(), | ||
})); | ||
jest.mock('react-router-dom', () => ({ | ||
...jest.requireActual('react-router-dom'), | ||
useNavigate: jest.fn(), | ||
})); | ||
|
||
const useUserMock = jest.mocked(useUser); | ||
useUserMock.mockReturnValue({ | ||
username: 'test-user', | ||
isAdmin: false, | ||
isAllowed: true, | ||
userLoading: false, | ||
userError: null, | ||
}); | ||
|
||
describe('EmptyProjects', () => { | ||
it('should show the create project button when allowed to create projects', async () => { | ||
render(<EmptyProjects allowCreate />); | ||
const createProject = await screen.findByTestId('create-data-science-project'); | ||
expect(createProject).toBeEnabled(); | ||
const bodyText = await screen.findByTestId('projects-empty-body-text'); | ||
expect(bodyText).toHaveTextContent( | ||
'Projects allow you and your team to organize and collaborate on resources within separate namespaces.', | ||
); | ||
expect(bodyText).not.toHaveTextContent('To request a project, contact your administrator.'); | ||
}); | ||
it('should show the who is my admin help when not allowed to create projects', async () => { | ||
render(<EmptyProjects allowCreate={false} />); | ||
const bodyText = await screen.findByTestId('projects-empty-body-text'); | ||
expect(bodyText).toHaveTextContent( | ||
'Projects allow you and your team to organize and collaborate on resources within separate namespaces. To request a project, contact your administrator.', | ||
); | ||
const adminHelpButton = await screen.findByTestId('projects-empty-admin-help'); | ||
act(() => adminHelpButton.click()); | ||
const helpContent = await screen.findByTestId('projects-empty-admin-help-content'); | ||
expect(helpContent).toBeVisible(); | ||
}); | ||
}); |