feat: Implement account deletion (mark for removal) feature
All checks were successful
Gitea Actions Demo / build-and-push (push) Successful in 23s
All checks were successful
Gitea Actions Demo / build-and-push (push) Successful in 23s
- Added `marked_for_deletion` and `marked_for_deletion_at` fields to User model (Python and TypeScript) with serialization updates - Created POST /api/user/mark-for-deletion endpoint with JWT auth, error handling, and SSE event trigger - Blocked login and password reset for marked users; added new error codes ACCOUNT_MARKED_FOR_DELETION and ALREADY_MARKED - Updated UserProfile.vue with "Delete My Account" button, confirmation modal (email input), loading state, success/error modals, and sign-out/redirect logic - Synced error codes and model fields between backend and frontend - Added and updated backend and frontend tests to cover all flows and edge cases - All Acceptance Criteria from the spec are complete and verified
This commit is contained in:
33
frontend/vue-app/src/stores/__tests__/auth.childmode.spec.ts
Normal file
33
frontend/vue-app/src/stores/__tests__/auth.childmode.spec.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
||||
import { isParentAuthenticated, loginUser } from '../auth'
|
||||
import { nextTick } from 'vue'
|
||||
|
||||
// Helper to mock localStorage
|
||||
global.localStorage = {
|
||||
store: {} as Record<string, string>,
|
||||
getItem(key: string) {
|
||||
return this.store[key] || null
|
||||
},
|
||||
setItem(key: string, value: string) {
|
||||
this.store[key] = value
|
||||
},
|
||||
removeItem(key: string) {
|
||||
delete this.store[key]
|
||||
},
|
||||
clear() {
|
||||
this.store = {}
|
||||
},
|
||||
} as any
|
||||
|
||||
describe('auth store - child mode on login', () => {
|
||||
beforeEach(() => {
|
||||
isParentAuthenticated.value = true
|
||||
localStorage.setItem('isParentAuthenticated', 'true')
|
||||
})
|
||||
|
||||
it('should clear isParentAuthenticated and localStorage on loginUser()', async () => {
|
||||
loginUser()
|
||||
await nextTick() // flush Vue watcher
|
||||
expect(isParentAuthenticated.value).toBe(false)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user