Skip to content

Commit

Permalink
chore: install and configure Jest with initial home page test
Browse files Browse the repository at this point in the history
  • Loading branch information
drichar committed Aug 10, 2023
1 parent ece74ca commit 94681ed
Show file tree
Hide file tree
Showing 6 changed files with 2,223 additions and 122 deletions.
3 changes: 3 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
NEXT_PUBLIC_NODE_NETWORK=mainnet
NEXT_PUBLIC_NODE_URL=https://mainnet-api.algonode.cloud
NEXT_PUBLIC_NODE_PORT=443
10 changes: 10 additions & 0 deletions __tests__/index.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { render, screen } from '@testing-library/react'
import Home from '@/pages/index'

describe('Home', () => {
it('renders the home page', () => {
render(<Home />)

expect(screen.getByText('UseWallet Demo')).toBeInTheDocument()
})
})
12 changes: 12 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const nextJest = require('next/jest')

const createJestConfig = nextJest({
dir: './'
})

const customJestConfig = {
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
testEnvironment: 'jest-environment-jsdom'
}

module.exports = createJestConfig(customJestConfig)
1 change: 1 addition & 0 deletions jest.setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import '@testing-library/jest-dom/extend-expect'
10 changes: 9 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
"lint": "next lint",
"test": "jest",
"test:watch": "jest --watchAll"
},
"dependencies": {
"@blockshake/defly-connect": "^1.1.5",
Expand Down Expand Up @@ -37,8 +39,14 @@
},
"devDependencies": {
"@tanstack/eslint-plugin-query": "^4.32.5",
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^14.0.0",
"@testing-library/user-event": "^14.4.3",
"@types/big.js": "^6.2.0",
"@types/testing-library__jest-dom": "^5.14.9",
"eslint-config-prettier": "^9.0.0",
"jest": "^29.6.2",
"jest-environment-jsdom": "^29.6.2",
"prettier": "3.0.1"
}
}
Loading

0 comments on commit 94681ed

Please sign in to comment.