Skip to content

Commit

Permalink
Merge pull request #77 from nr2f1/localised-footer
Browse files Browse the repository at this point in the history
Localised footer
  • Loading branch information
pataruco authored Sep 6, 2024
2 parents 628a7eb + f1cbe40 commit 627393e
Show file tree
Hide file tree
Showing 14 changed files with 729 additions and 83 deletions.
2 changes: 1 addition & 1 deletion .github/actions/get-affected-files/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ runs:
using: composite
steps:
- name: Sets the base and head SHAs required for the nx affected
uses: nrwl/nx-set-shas@v3
uses: nrwl/nx-set-shas@v4

- name: Checkout the code
shell: bash
Expand Down
16 changes: 3 additions & 13 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ jobs:
prepare:
name: Prepare
runs-on: ubuntu-latest
strategy:
fail-fast: true
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
Expand All @@ -31,8 +29,6 @@ jobs:
conventional-commits:
name: Conventional Commits
runs-on: ubuntu-latest
strategy:
fail-fast: true
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
Expand All @@ -48,8 +44,6 @@ jobs:
lint-format:
name: Linting and formatting
runs-on: ubuntu-latest
strategy:
fail-fast: true
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
Expand All @@ -58,7 +52,7 @@ jobs:

- name: Set environment and install dependencies
uses: ./.github/actions/prepare

- name: Get affected files
uses: ./.github/actions/get-affected-files

Expand All @@ -68,8 +62,6 @@ jobs:
unit-tests:
name: Unit tests
runs-on: ubuntu-latest
strategy:
fail-fast: true
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
Expand All @@ -78,7 +70,7 @@ jobs:

- name: Set environment and install dependencies
uses: ./.github/actions/prepare

- name: Get affected files
uses: ./.github/actions/get-affected-files

Expand All @@ -87,11 +79,9 @@ jobs:

ci-validation:
name: CI validation
needs: [prepare, conventional-commits, lint-format, unit-tests]
needs: [prepare, conventional-commits, lint-format, unit-tests]
if: ${{ always() }}
runs-on: ubuntu-latest
strategy:
fail-fast: true
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
Expand Down
1 change: 1 addition & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
"organizeImports": {
"enabled": true,
"ignore": [
".next",
"dist",
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"dependencies": {
"@apollo/client": "^3.11.4",
"@apollo/experimental-nextjs-app-support": "^0.11.2",
"@contentful/rich-text-react-renderer": "^15.22.10",
"@formatjs/intl-localematcher": "^0.5.4",
"@mui/base": "5.0.0-beta.40",
"formik": "^2.4.6",
Expand Down
22 changes: 22 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion website/src/app/[lang]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const RootLayout: React.FC<RootLayoutProps> = ({
<ApolloWrapper>
<Header lang={lang} />
<main>{children}</main>
<Footer />
<Footer lang={lang} />
</ApolloWrapper>
</body>
</html>
Expand Down
167 changes: 167 additions & 0 deletions website/src/components/footer/index.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
import * as FooterGraphql from '@graphql/queries/footer/index.generated';
import { render, waitFor } from '@testing-library/react';
import axe from '@tests/a11y/test-utils';
import { describe, expect, it, vi } from 'vitest';
import Footer from './markup';

const locale = 'en';

vi.mock('next/navigation', async (importOriginal) => {
const actual = await importOriginal();
return {
// @ts-ignore
...actual,
useRouter() {
return {
push: () => vi.fn(),
};
},
usePathname() {
return `/${locale}`;
},
};
});

const result = {
data: {
stayInTouch: {
content: 'Stay in touch',
},
socialMediaText: {
content: {
json: {
data: {},
content: [
{
data: {},
content: [
{
data: {},
marks: [],
value: 'Connect with us via our social media channels:',
nodeType: 'text',
},
],
nodeType: 'paragraph',
},
],
nodeType: 'document',
},
},
},
footerForm: {
content: {
json: {
data: {},
content: [
{
data: {},
content: [
{
data: {},
marks: [],
value:
'Sign up to receive news and updates from the NR2F1 Foundation',
nodeType: 'text',
},
],
nodeType: 'paragraph',
},
],
nodeType: 'document',
},
},
},
copyright: {
content: {
json: {
data: {},
content: [
{
data: {},
content: [
{
data: {},
marks: [],
value: 'copyright',
nodeType: 'text',
},
],
nodeType: 'paragraph',
},
],
nodeType: 'document',
},
},
},
warning: {
content: {
json: {
data: {},
content: [
{
data: {},
content: [
{
data: {},
marks: [],
value: 'warning',
nodeType: 'text',
},
],
nodeType: 'paragraph',
},
],
nodeType: 'document',
},
},
},
contactUs: {
content: {
json: {
data: {},
content: [
{
data: {},
content: [
{
data: {},
marks: [],
value: 'contact us',
nodeType: 'text',
},
],
nodeType: 'paragraph',
},
],
nodeType: 'document',
},
},
},
},
};

const useGetFooterSuspenseQuerySpy = vi.spyOn(
FooterGraphql,
'useGetFooterSuspenseQuery',
);

describe('Header', () => {
useGetFooterSuspenseQuerySpy.mockImplementation(() => ({
...result,
// @ts-ignore
client: null,
// @ts-ignore
error: null,
// @ts-ignore
fetchMore: null,
// @ts-ignore
networkStatus: null,
}));

it('renders without any accessibility violation', async () => {
const { container } = render(<Footer lang={locale} />);
const results = await waitFor(() => axe(container), { timeout: 5000 });
expect(results).toHaveNoViolations();
});
});
Loading

0 comments on commit 627393e

Please sign in to comment.