fix: all lint errors, test + lint pre-commit passing
Frontend: - Split nodeTypes/edgeTypes into separate .ts files (react-refresh) - Remove setState-in-effect in NodeModal (key prop reset) - Fix handleSave accessed before declaration (useRef pattern) - Exclude src/components/ui/** from eslint (shadcn generated) - Use defineConfig from vitest/config for test type support Backend: - ruff --fix: sort imports, datetime.UTC alias - Raise line-length to 120, ignore E501 in tests - Break long update_node/update_edge signatures - pyproject.toml: per-file-ignores for tests
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import { describe, it, expect, beforeEach } from 'vitest'
|
||||
import { useAuthStore } from '@/stores/authStore'
|
||||
|
||||
describe('authStore', () => {
|
||||
beforeEach(() => {
|
||||
useAuthStore.setState({ token: null, isAuthenticated: false })
|
||||
})
|
||||
|
||||
it('starts unauthenticated', () => {
|
||||
const { token, isAuthenticated } = useAuthStore.getState()
|
||||
expect(token).toBeNull()
|
||||
expect(isAuthenticated).toBe(false)
|
||||
})
|
||||
|
||||
it('login sets token and isAuthenticated', () => {
|
||||
useAuthStore.getState().login('my-jwt-token')
|
||||
const { token, isAuthenticated } = useAuthStore.getState()
|
||||
expect(token).toBe('my-jwt-token')
|
||||
expect(isAuthenticated).toBe(true)
|
||||
})
|
||||
|
||||
it('logout clears token and isAuthenticated', () => {
|
||||
useAuthStore.getState().login('my-jwt-token')
|
||||
useAuthStore.getState().logout()
|
||||
const { token, isAuthenticated } = useAuthStore.getState()
|
||||
expect(token).toBeNull()
|
||||
expect(isAuthenticated).toBe(false)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user