add simple unit test

This commit is contained in:
Moriz Wahl 2025-02-03 21:05:25 +01:00
parent 69c735bae3
commit 1a2b2275e5
4 changed files with 2082 additions and 221 deletions

2260
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,8 @@
"scripts": {
"build": "rollup -c",
"start": "rollup -c -w",
"test:lint:eslint": "eslint --ext .ts,.tsx,.js,.jsx,.cjs,.mjs,.json,.yml,.yaml --max-warnings 0 ."
"test:lint:eslint": "eslint --ext .ts,.tsx,.js,.jsx,.cjs,.mjs,.json,.yml,.yaml --max-warnings 0 .",
"test:unit": "vitest"
},
"files": [
"dist"
@ -19,6 +20,7 @@
"license": "GPL-3.0-only",
"devDependencies": {
"@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
"@testing-library/react": "^16.2.0",
"@types/geojson": "^7946.0.14",
"@types/leaflet": "^1.7.11",
"@types/react": "^18.2.0",
@ -40,30 +42,33 @@
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-security": "^3.0.1",
"eslint-plugin-yml": "^1.14.0",
"globals": "^15.14.0",
"happy-dom": "^16.8.1",
"postcss": "^8.4.21",
"prettier": "^3.3.3",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"rollup": "^2.75.7",
"rollup-plugin-postcss": "^4.0.2",
"rollup-plugin-typescript2": "^0.32.1",
"tailwindcss": "^3.3.1",
"typescript": "^4.7.4"
},
"peerDependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0"
"typescript": "^4.7.4",
"vite": "^6.0.11",
"vitest": "^3.0.5"
},
"dependencies": {
"@heroicons/react": "^2.0.17",
"@tanstack/react-query": "^5.17.8",
"@types/offscreencanvas": "^2019.7.1",
"@vitejs/plugin-react": "^4.3.4",
"axios": "^1.6.5",
"date-fns": "^3.3.1",
"leaflet": "^1.9.4",
"leaflet.locatecontrol": "^0.79.0",
"prop-types": "^15.8.1",
"react": "^18.2.0",
"react-colorful": "^5.6.1",
"react-dom": "^18.2.0",
"react-image-crop": "^10.1.8",
"react-leaflet": "^4.2.1",
"react-leaflet-cluster": "^2.1.0",

View File

@ -0,0 +1,11 @@
import { render } from '@testing-library/react'
import { describe, it, expect } from 'vitest'
import { TextInput } from './TextInput'
describe('<TextInput />', () => {
it('renders properly', () => {
const wrapper = render(<TextInput />)
expect(wrapper).toBeTruthy()
})
})

11
vite.config.ts Normal file
View File

@ -0,0 +1,11 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
export default defineConfig({
plugins: [react()],
test: {
globals: true,
environment: 'happy-dom'
},
})