Enhance frontend testing setup and refactor TrainingPlanningPageRoot component
Deploy Development / deploy (push) Successful in 44s
Test Suite / pytest-backend (push) Successful in 37s
Test Suite / lint-backend (push) Successful in 1s
Test Suite / build-frontend (push) Successful in 19s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m21s
Deploy Development / deploy (push) Successful in 44s
Test Suite / pytest-backend (push) Successful in 37s
Test Suite / lint-backend (push) Successful in 1s
Test Suite / build-frontend (push) Successful in 19s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m21s
- Added Vitest as a testing framework and included test scripts in package.json for improved testing capabilities. - Refactored TrainingPlanningPageRoot component by removing unused state variables and imports, streamlining the code for better readability and performance. - Introduced new utility functions for planning routes to enhance navigation within the training planning interface.
This commit is contained in:
1 parent
295c7e7efc
commit
16eaf839e7
17 files changed
+1854
-786
No files matched your search
@@ -0,0 +1,45 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import {
|
||||
buildTrainingUnitSavePayload,
|
||||
createEmptyTrainingUnitFormData,
|
||||
validateTrainingUnitFormForSave,
|
||||
} from './trainingUnitEditorCore.js'
|
||||
|
||||
describe('trainingUnitEditorCore', () => {
|
||||
it('createEmptyTrainingUnitFormData defaults', () => {
|
||||
const fd = createEmptyTrainingUnitFormData({ groupId: '2', plannedDate: '2026-05-01' })
|
||||
expect(fd.group_id).toBe('2')
|
||||
expect(fd.planned_date).toBe('2026-05-01')
|
||||
expect(fd.sections).toHaveLength(1)
|
||||
expect(fd.sections[0].title).toBe('Hauptteil')
|
||||
})
|
||||
|
||||
it('validateTrainingUnitFormForSave', () => {
|
||||
expect(validateTrainingUnitFormForSave({ group_id: '', planned_date: '' }).ok).toBe(false)
|
||||
expect(validateTrainingUnitFormForSave({ group_id: '1', planned_date: '2026-01-01' }).ok).toBe(true)
|
||||
})
|
||||
|
||||
it('buildTrainingUnitSavePayload create includes group and template', () => {
|
||||
const formData = createEmptyTrainingUnitFormData({ groupId: '5', plannedDate: '2026-05-10' })
|
||||
const payload = buildTrainingUnitSavePayload(formData, { draftPlanTemplateId: '9' })
|
||||
expect(payload.group_id).toBe(5)
|
||||
expect(payload.plan_template_id).toBe(9)
|
||||
expect(payload.planned_date).toBe('2026-05-10')
|
||||
expect(payload.sections).toBeDefined()
|
||||
})
|
||||
|
||||
it('buildTrainingUnitSavePayload update sets debrief and clears lead when empty', () => {
|
||||
const formData = {
|
||||
...createEmptyTrainingUnitFormData({ groupId: '5', plannedDate: '2026-05-10' }),
|
||||
status: 'completed',
|
||||
debrief_completed: true,
|
||||
lead_trainer_profile_id: '',
|
||||
session_assistants_inherit: true,
|
||||
}
|
||||
const payload = buildTrainingUnitSavePayload(formData, { editingUnit: { id: 1 } })
|
||||
expect(payload.debrief_completed).toBe(true)
|
||||
expect(payload.lead_trainer_profile_id).toBeNull()
|
||||
expect(payload.assistant_trainer_profile_ids).toBeNull()
|
||||
expect(payload.group_id).toBeUndefined()
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user