-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cb29903
commit 6f49303
Showing
111 changed files
with
3,269 additions
and
778 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
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
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
// SPDX-FileCopyrightText: 2023 Dusan Mijatovic (Netherlands eScience Center) | ||
// SPDX-FileCopyrightText: 2023 Dusan Mijatovic (dv4all) | ||
// SPDX-FileCopyrightText: 2023 Dusan Mijatovic (dv4all) (dv4all) | ||
// SPDX-FileCopyrightText: 2023 Ewan Cahen (Netherlands eScience Center) <[email protected]> | ||
|
@@ -11,8 +12,18 @@ import {WithAppContext, mockSession} from '~/utils/jest/WithAppContext' | |
|
||
import UserPages from '../pages/user/[section]' | ||
|
||
import mockSoftwareByMaintainer from '~/components/user/software/__mocks__/softwareByMaintainer.json' | ||
import mockProjectsByMaintainer from '~/components/user/project/__mocks__/projectsByMaintainer.json' | ||
|
||
// use DEFAULT MOCK for login providers list | ||
// required when AppHeader component is used | ||
jest.mock('~/auth/api/useLoginProviders') | ||
// MOCK user agreement call | ||
jest.mock('~/components/user/settings/fetchAgreementStatus') | ||
// MOCK user project list | ||
jest.mock('~/components/user/project/useUserProjects') | ||
// MOCK user software list | ||
jest.mock('~/components/user/software/useUserSoftware') | ||
|
||
// MOCKS | ||
const mockProps = { | ||
|
@@ -73,25 +84,29 @@ describe('pages/user/[section].tsx', () => { | |
it('renders user software section', async() => { | ||
mockProps.section = 'software' | ||
|
||
const {container} = render( | ||
render( | ||
<WithAppContext options={{session:mockSession}}> | ||
<UserPages {...mockProps} /> | ||
</WithAppContext> | ||
) | ||
|
||
const loader = screen.getByRole('progressbar') | ||
// validate software cards are shown | ||
const software = screen.getAllByTestId('software-card-link') | ||
expect(software.length).toEqual(mockSoftwareByMaintainer.length) | ||
}) | ||
|
||
it('renders user projects section', async() => { | ||
mockProps.section = 'projects' | ||
|
||
const {container} = render( | ||
render( | ||
<WithAppContext options={{session:mockSession}}> | ||
<UserPages {...mockProps} /> | ||
</WithAppContext> | ||
) | ||
|
||
const loader = screen.getByRole('progressbar') | ||
// validate project cards are shown | ||
const project = screen.getAllByTestId('project-card-link') | ||
expect(project.length).toEqual(mockProjectsByMaintainer.length) | ||
}) | ||
|
||
}) |
2 changes: 2 additions & 0 deletions
2
frontend/auth/index.test.tsx → frontend/auth/AuthIndex.test.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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// SPDX-FileCopyrightText: 2023 Dusan Mijatovic (Netherlands eScience Center) | ||
// SPDX-FileCopyrightText: 2023 Netherlands eScience Center | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import {Session} from '..' | ||
import {mockSession} from '~/utils/jest/WithAppContext' | ||
|
||
export async function refreshSession(): Promise<Session | null> { | ||
// return default mocked session | ||
return mockSession | ||
} |
Oops, something went wrong.