-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #236 from CDLUC3/chore/JS-update-main-with-latest-…
…development Chore/js update main with latest development
- Loading branch information
Showing
176 changed files
with
11,933 additions
and
3,876 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
NEXT_PUBLIC_REGION="us-west-2" | ||
NEXT_PUBLIC_USER_POOL_ID="us-west-2_FIxM1Z1KE" | ||
NEXT_PUBLIC_POOL_APP_CLIENT_ID="64dhg7i512t4gbncbtiuui1oio" | ||
NEXT_PUBLIC_BASE_URL="http://localhost:3000" | ||
NEXT_PUBLIC_SERVER_ENDPOINT="http://localhost:4000" | ||
NEXT_PUBLIC_GRAPHQL_SERVER_ENDPOINT="http://localhost:4000/graphql" | ||
|
||
NEXT_PUBLIC_GRAPHQL_ENDPOINT="http://localhost:4000" | ||
NEXT_PUBLIC_GRAPHQL_SERVER_ENDPOINT="http://localhost:4000/graphql" | ||
|
||
# JSON Web Token (JWT) settings | ||
JWT_SECRET= | ||
|
||
#Crowdin | ||
CROWDIN_PERSONAL_TOKEN= | ||
CROWDIN_PROJECT_ID= |
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 |
---|---|---|
|
@@ -36,4 +36,4 @@ yarn-error.log* | |
*.tsbuildinfo | ||
next-env.d.ts | ||
|
||
tmp.js | ||
tmp.js |
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
File renamed without changes.
File renamed without changes.
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,70 @@ | ||
import React, {ReactNode} from 'react'; | ||
import {act, render, screen, waitFor} from '@testing-library/react'; | ||
import {axe, toHaveNoViolations} from 'jest-axe'; | ||
import ConnectionsPage from '../page'; | ||
|
||
expect.extend(toHaveNoViolations); | ||
|
||
jest.mock('@/components/PageHeader', () => { | ||
const mockPageHeader = jest.fn(({ children }: { children: ReactNode, title: string }) => ( | ||
<div data-testid="mock-page-wrapper">{children}</div> | ||
)); | ||
return { | ||
__esModule: true, | ||
default: mockPageHeader | ||
} | ||
}); | ||
|
||
|
||
describe('Connections page', () => { | ||
beforeEach(() => { | ||
jest.clearAllMocks(); | ||
}); | ||
|
||
afterEach(() => { | ||
jest.restoreAllMocks(); | ||
}) | ||
|
||
it('should render the component with PageHeader', async () => { | ||
const titleProp = 'Connections'; | ||
const pageHeader = await import('@/components/PageHeader'); | ||
const mockPageHeader = pageHeader.default; | ||
const { getByTestId } = render(<ConnectionsPage />); | ||
|
||
expect(getByTestId('mock-page-wrapper')).toBeInTheDocument(); | ||
expect(mockPageHeader).toHaveBeenCalledWith(expect.objectContaining({ title: titleProp, }), {}) | ||
}) | ||
|
||
it('should render connections page', async () => { | ||
|
||
await act(async () => { | ||
render( | ||
<ConnectionsPage /> | ||
|
||
); | ||
}); | ||
|
||
const heading4Elements = screen.getAllByRole('heading', { level: 2 }); | ||
expect(heading4Elements.length).toBe(3); | ||
|
||
const buttons = screen.getAllByRole('button'); | ||
expect(buttons.length).toBe(3); | ||
}); | ||
|
||
it('should pass axe accessibility test', async () => { | ||
let container: HTMLElement; | ||
await act(async () => { | ||
const renderResult = render( | ||
|
||
<ConnectionsPage /> | ||
|
||
); | ||
container = renderResult.container; | ||
}); | ||
|
||
await waitFor(async () => { | ||
const results = await axe(container); | ||
expect(results).toHaveNoViolations(); | ||
}); | ||
}) | ||
}) |
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,60 @@ | ||
'use client' | ||
|
||
import React from 'react'; | ||
import sanitizeHtml from 'sanitize-html'; | ||
import ConnectionSection from '@/components/ConnectionSection'; | ||
import PageHeader from '@/components/PageHeader'; | ||
import {ContentContainer, LayoutContainer,} from '@/components/Container'; | ||
|
||
const REDIRECT_URI = process.env.NEXT_PUBLIC_ORCID_DEV_CALLBACK; | ||
const ORCID_CLIENT_ID = process.env.NEXT_PUBLIC_ORCID_CLIENT_ID; | ||
|
||
const ConnectionsPage: React.FC = () => { | ||
|
||
// Sandbox Uri | ||
//const orcidUri = `https://sandbox.orcid.org/oauth/authorize?client_id=${orcidClientId}&response_type=code&scope=/read-limited&redirect_uri=${redirectURI}`; | ||
|
||
//Production Uri | ||
const orcidUri = `https://orcid.org/oauth/authorize?client_id=${ORCID_CLIENT_ID}&response_type=code&scope=/authenticate&redirect_uri=${REDIRECT_URI}`; | ||
|
||
const orcidContentString = sanitizeHtml('ORCID provides a persistent identifier - an ORCID iD - that distinguishes you from other users. Learn more at <a href="https://orcid.org/" target="_blank" rel="noopener noreferrer">ORCID.org</a>.'); | ||
|
||
return ( | ||
<> | ||
<PageHeader title="Connections" /> | ||
<LayoutContainer> | ||
<ContentContainer> | ||
<div className="sectionContainer"> | ||
<div className="sectionContent"> | ||
<ConnectionSection | ||
type='orcid' | ||
title='ORCID iD - not connected' | ||
content={orcidContentString} | ||
btnUrl={orcidUri} | ||
btnImageUrl='/images/orcid.svg' | ||
btnText='Connect your ORCID iD' | ||
/> | ||
<ConnectionSection | ||
type='orcidtest' | ||
title='ORCiD state when user is connected' | ||
content='This is to test the display of the orcid id once the user has connected.' | ||
btnUrl='/users/auth/orcid/test' | ||
btnImageUrl='/images/orcid.svg' | ||
btnText='Connect your ORCID iD Test' | ||
/> | ||
<ConnectionSection | ||
type='sso' | ||
title='Single Sign On' | ||
content='Connect your account so that you can log into DMP Tool via your institution.' | ||
btnUrl='' | ||
btnText='Connect institutional credentials' | ||
/> | ||
</div> | ||
</div> | ||
</ContentContainer> | ||
</LayoutContainer> | ||
</> | ||
) | ||
} | ||
|
||
export default ConnectionsPage; |
File renamed without changes.
File renamed without changes.
Oops, something went wrong.