Skip to content

Commit

Permalink
test: add tests files
Browse files Browse the repository at this point in the history
  • Loading branch information
thedaviddias committed Jun 11, 2023
1 parent 277afce commit 32ae09d
Show file tree
Hide file tree
Showing 20 changed files with 3,465 additions and 1,616 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/production-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ jobs:
version: 7
run_install: false

- name: Run tests
run: pnpm test

# - name: SimpleLocalize Download
# uses: simplelocalize/download@latest
# with:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/staging-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ jobs:
if: steps.pnpm-cache.outputs.cache-hit != 'true'
run: pnpm install

- name: Run tests
run: pnpm test

- name: Upload translations
uses: simplelocalize/upload@latest
with:
Expand Down
4 changes: 3 additions & 1 deletion i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"defaultLocale": "en",
"localeDetection": false,
"pages": {
"*": ["common"]
"*": ["common", "about"],
"/404": ["404"],
"/about": ["about"]
}
}
12 changes: 12 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'jsdom',
testPathIgnorePatterns: ['<rootDir>/.next/', '<rootDir>/node_modules/'],
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
transform: {
'^.+\\.(js|jsx|ts|tsx)$': ['babel-jest', { presets: ['next/babel'] }],
},
moduleNameMapper: {
'\\.(css|less|scss|sass)$': 'identity-obj-proxy',
},
}
1 change: 1 addition & 0 deletions jest.setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import '@testing-library/jest-dom/extend-expect'
9 changes: 9 additions & 0 deletions locales/en/404.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"404": {
"back_home": "Back Home",
"seo": {
"title": "Sorry 😩, this page can't be found.",
"description": "This page is the nightmare of any user. It's usually an ugly page that just tells you that the link doesn't exist. Fortunately, the world doesn't end yet!"
}
}
}
10 changes: 10 additions & 0 deletions locales/en/about.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"about": {
"path": "/about",
"seo": {
"url": "about",
"title": "About me",
"description": "Learn a little bit about 'The David Dias'"
}
}
}
9 changes: 9 additions & 0 deletions locales/fr/404.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"404": {
"back_home": "Retour à l'accueil",
"seo": {
"title": "Désolé 😩, cette page ne peut pas être trouvée.",
"description": ""
}
}
}
10 changes: 10 additions & 0 deletions locales/fr/about.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"about": {
"path": "/about",
"seo": {
"url": "about",
"title": "À propos de l'auteur",
"description": "Sachez-en un peu plus sur 'The David Dias'"
}
}
}
15 changes: 0 additions & 15 deletions locales/fr/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,6 @@
"search_placeholder": "Tapez un mot pour faire une recherche"
}
},
"about": {
"path": "/about",
"seo": {
"url": "about",
"title": "À propos de l'auteur",
"description": "Sachez-en un peu plus sur 'The David Dias'"
}
},
"uses": {
"path": "/uses",
"seo": {
Expand Down Expand Up @@ -162,13 +154,6 @@
"rss": {
"path": "/rss/fr/feed.xml"
},
"404": {
"back_home": "Retour à l'accueil",
"seo": {
"title": "Désolé 😩, cette page ne peut pas être trouvée.",
"description": ""
}
},
"500": {
"title": "Wow 😱, you broke everything.",
"seo": {
Expand Down
10 changes: 9 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"lint:write": "eslint . --ext js,ts,tsx,mdx,json --fix --max-warnings=0",
"prepare": "husky install",
"publish": "node scripts/publish-blog.js",
"start": "next start"
"start": "next start",
"test": "jest"
},
"dependencies": {
"@giscus/react": "^2.2.8",
Expand Down Expand Up @@ -53,6 +54,9 @@
"@sentry/nextjs": "7.54.0",
"@sentry/node": "7.54.0",
"@svgr/webpack": "6.5.1",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^14.0.0",
"@types/jest": "^29.5.2",
"@types/node": "18.6.5",
"@types/prettier": "^2.7.3",
"@types/react": "18.2.11",
Expand All @@ -62,6 +66,7 @@
"@typescript-eslint/parser": "5.59.9",
"axe-core": "4.7.2",
"axios": "1.4.0",
"babel-jest": "^29.5.0",
"camel-case": "^4.1.2",
"clsx": "^1.2.1",
"date-fns": "2.30.0",
Expand All @@ -77,6 +82,8 @@
"hast-util-heading-rank": "^2.1.0",
"hast-util-to-string": "^2.0.0",
"husky": "8.0.3",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
"lint-staged": "13.2.2",
"next-bundle-analyzer": "0.6.7",
"next-sitemap": "4.1.3",
Expand All @@ -96,6 +103,7 @@
"rehype-stringify": "^9.0.3",
"remark-gfm": "^3.0.1",
"swr": "2.1.5",
"ts-jest": "^29.1.0",
"ts-node": "^10.9.1",
"typescript": "4.7.4",
"unified": "^10.1.2",
Expand Down
Loading

1 comment on commit 32ae09d

@vercel
Copy link

@vercel vercel bot commented on 32ae09d Jun 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.